# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
122958 | 2019-06-29T16:38:02 Z | egorlifar | JOIRIS (JOI16_joiris) | C++17 | 2 ms | 384 KB |
#include <bits/stdc++.h> #define L long long using namespace std; L n,k; L a[55]; vector<L>ans1,ans2; int main() { scanf("%lld %lld",&n,&k); L i,j,k; for(i=1;i<=n;i++) { scanf("%lld",&a[i]); } for(i=2;i<=n;i++) { while(a[i]<a[i-1]) { ans1.push_back(1); ans2.push_back(i); a[i]+=2; } } for(i=2;i<=n;i++) { a[i]-=a[1]; } a[1]=0; for(i=3;i<=n;i++) { while(a[i]>a[i-1]) { for(j=i-2;j>=1;j-=2) { ans1.push_back(2); ans2.push_back(j); a[j]++; a[j+1]++; if(j==1) { for(k=1;k<=n;k++) { a[k]--; } } } /*puts(""); for(k=1;k<=n;k++) { printf("%lld ",a[k]); } puts("");*/ } } for(i=1;i<=a[2]/2;i++) { ans1.push_back(1); ans2.push_back(1); } if(a[2]%2) { puts("-1"); return 0; } printf("%lld\n",ans1.size()); for(i=0;i<ans1.size();i++) { printf("%lld %lld\n",ans1[i],ans2[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 380 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 380 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 380 KB | Output is correct |
17 | Incorrect | 2 ms | 384 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 380 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 380 KB | Output is correct |
17 | Incorrect | 2 ms | 256 KB | Output isn't correct |
18 | Halted | 0 ms | 0 KB | - |