| Task: | Physical Music |
| Sender: | Antti Röyskö |
| Submission time: | 2017-10-17 19:58:42 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.14 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:28:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<ans.size(); ++i) cout << ans[i] << "\n";
^Code
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int T;
bool is[101010];
vector<int> ans;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> T;
for (int i=0; i<T; ++i){
int N;
cin >> N;
for (int j=0; j<=N; ++j) is[j]=0;
ans.clear();
int gg=1;
for (int i=1; i<=N; ++i){
int st;
cin >> st;
is[st]=1;
if (st>gg) ans.push_back(st);
while (is[gg]) ++gg;
}
sort(ans.begin(), ans.end());
cout << ans.size() << "\n";
for (int i=0; i<ans.size(); ++i) cout << ans[i] << "\n";
}
}