# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
304923 |
2020-09-22T08:06:10 Z |
EMEJ |
JOIRIS (JOI16_joiris) |
C++11 |
|
1 ms |
384 KB |
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define pii pair <int,int>
#define all(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
using namespace std;
const int N=60;
int a[N];
vector <pii> ans,prt[2];
int32_t main(){
ios::sync_with_stdio(0);cin.tie(0);
int n,x;
cin>>n>>x;
for(int i=1;i<=n;i++){
cin>>a[i];
while(a[i]<N){
a[i]+=2;
ans.pb({1,i});
}
}
int j=1,res0=1,res1=1;
for(int i=1;i<=n;i=j){
while(j<=n && a[i]%2==a[j]%2) j++;
for(int k=i;k<j;k+=2){
prt[a[i]%2].pb({2,k});
}
if((j-i)%2){
if(a[i]%2) res1=0;
else res0=0;
}
}
if(res0){
cout<<SZ(ans)+SZ(prt[0])<<endl;
for(pii p:ans) cout<<p.F<<" "<<p.S<<endl;
for(pii p:prt[0]) cout<<p.F<<" "<<p.S<<endl;
}
else if(res1){
cout<<SZ(ans)+n-SZ(prt[1])<<endl;
for(pii p:ans) cout<<p.F<<" "<<p.S<<endl;
for(int i=1;i<=n;i++) if(a[i]%2==0) cout<<1<<" "<<i<<endl;
for(pii p:prt[1]) cout<<p.F<<" "<<p.S<<endl;
}
else cout<<-1<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |