CSES - BAPC 2015 - Results
Submission details
Task:Physical Music
Sender:KnowYourArchitecture
Submission time:2017-10-17 20:41:28 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.30 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:23:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<res.size();++i)cout<<res[i]<<'\n';
                          ^

Code

#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;

int main(){
	int Tn;
	cin>>Tn;
	while(Tn--){
		int n;
		cin >> n;
		vector<int> res;
		int t=1;
		for (int i = 0; i < n; i++) {
			int a;
			cin >> a;
			if (a==t)++t;
			else res.emplace_back(a);
		}
		sort(res.begin(),res.end());
		cout<<res.size()<<'\n';
		for(int i=0;i<res.size();++i)cout<<res[i]<<'\n';
	}
}

Test details

Test 1

Verdict:

input
20
3
1
2
3
...

correct output
0
2
3
4
3
...

user output
0
2
3
4
3
...