Submission details
Task:Mascot Song
Sender:Uolevi
Submission time:2018-07-04 19:48:40 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1details
#20.02 s1details
#30.02 s1details
#40.24 s2details
#50.27 s2details
#60.25 s2details
#7--3details
#8--3details
#9--3details
#10--3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:33:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<ve.size()-1;i++){
              ~^~~~~~~~~~~~
input/code.cpp:71:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<va.size();i++){
                 ~^~~~~~~~~~
input/code.cpp:77:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<ve.size()-1;i++){
                 ~^~~~~~~~~~~~

Code

#include<bits/stdc++.h>
using namespace std;

int n;
int m;
int k;
int y;
int z;
int x;
int c;
vector<int> ve;
vector<int> va;
int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x;
		ve.push_back(x);
	}
	cin >> m;
/*	for(int i=0;i<m;i++){
		cin >> k >> x;
		if(k==1){
			cin >> y;
			ve[x-1] = y;			
		}
		c = 1;
		for(int i=0;i<ve.size();i++){
//			cout << ve[i] << " ";
		}
		cout << "\n";
		cout << c << "\n";
	}*/
	for(int i=0;i<ve.size()-1;i++){
		if(ve[i] >= ve[i+1]){
			c++;
		}
	}
	c++;
	for(int i=0;i<m;i++){
		cin >> k >> x;
		if(k == 1){
			cin >> y;
			if(x!=1&&x!=n){
			//	cout << c << "\n";
//				if(ve[x-1]>=ve[x]) c--;
//				if(ve[x-1]<=ve[x-2]) c--;
				c += (ve[x-1]<=ve[x])-(y<=ve[x]);
				c += (ve[x-1]>=ve[x-2])-(y>=ve[x-2]);
				ve[x-1] = y;
//				for(auto u : ve)cout << u << " ";
//				cout << "\n";
//				if(ve[x-1] >= ve[x]) c++;
//				if(ve[x-1] <= ve[x-2]) c++;
			}
			else{
				if(x==1){
					if(ve[1] <= x) c--;
					ve[0] = x;
					if(ve[1] <= y) c++;
				}else{
					if(ve[n-2] >= x) c--;
					ve[n-1] = x;
					if(ve[n-2] >= y) c++;
				}
			}
//			cout << c << "\n";
		}
		else{
			if(k==2){
				va = ve;
				for(int i=0;i<va.size();i++){
					va[(va.size()+(i-x))%va.size()] = ve[i];
				}
				cout << "\n";
				ve = va;
				c = 1;
				for(int i=0;i<ve.size()-1;i++){
					if(ve[i] >= ve[i+1]){
						c++;
					}
				}
			}
		}
		cout << c << "\n";
	}
}

Test details

Test 1

Group: 1

Verdict:

input
10
4 5 6 1 10 20 15 16 17 1
13
1 10 2
2 9
...

correct output
4
3
4
4
4
...

user output
4

4
5
5
...

Test 2

Group: 1

Verdict:

input
30
18 48 48 7 60 21 11 49 14 10 1...

correct output
16
17
17
17
16
...

user output
16
17
17
17
16
...

Test 3

Group: 1

Verdict:

input
100
11 16 18 16 14 7 6 1 22 8 19 5...

correct output
50
50
50
50
49
...

user output
50
50
50
50
49
...

Test 4

Group: 2

Verdict:

input
80000
581256238 412911089 468450337 ...

correct output
39831
39830
39830
39830
39831
...

user output
39831
39830
39830
39830
39831
...

Test 5

Group: 2

Verdict:

input
150000
2013 2014 2014 2014 2014 2014 ...

correct output
150000
149999
149998
149997
149996
...

user output
150000
150001
150002
150003
150004
...

Test 6

Group: 2

Verdict:

input
190000
62 4981 98 3407 7210 6339 1348...

correct output
94991
94991
94991
94992
94992
...

user output
94991
94991
94991
94992
94992
...

Test 7

Group: 3

Verdict:

input
50000
446 494 191 356 886 78 470 223...

correct output
24959
24959
24960
24960
24960
...

user output
(empty)

Test 8

Group: 3

Verdict:

input
170333
1 1001 2001 3001 4001 5001 600...

correct output
2
3
3
3
4
...

user output
(empty)

Test 9

Group: 3

Verdict:

input
200000
571574128 419362929 843317486 ...

correct output
100061
100061
100061
100060
100060
...

user output
(empty)

Test 10

Group: 3

Verdict:

input
200000
262656227 860259516 849559109 ...

correct output
99946
99946
99947
99947
99947
...

user output
(empty)