# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
673906 | 2022-12-22T11:20:39 Z | ReLice | Nice sequence (IZhO18_sequence) | C++14 | 1 ms | 332 KB |
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define pb push_back #define fr first #define sc second void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const ll N = 4e5 + 10 ; const ll mod=1e9+7; ll pr[N],suf[N]; void solve(){ ll n,i,x,y,mx=-1; ll m,k,sum=0,c=0,j; cin>>n>>m; if(n==m){ cout<<n-1<<endl; for(i=0;i<n-1;i++){ cout<<1<<' '; } } else{ ll mn=min(n,m); mx=max(n,m); if(mn*2-1>mx-1){ cout<<mn*2-1<<endl; if(mn==n){ for(i=1;i<mn;i++){ cout<<2<<' '; } cout<<-mn*2+1<<' '; for(i=1;i<mn;i++){ cout<<2<<' '; } } else { for(i=1;i<mn;i++){ cout<<-2<<' '; } cout<<mn*2-1<<' '; for(i=1;i<mn;i++){ cout<<-2<<' '; } } } else { cout<<mx-1<<endl; if(n<m){ for(i=1;i<m;i++){ cout<<-1<<' '; } } else { for(i=1;i<n;i++){ cout<<1<<' '; } } } } cout<<endl; } main(){ //fre(""); start(); ll t=1; cin>>t; while(t--)solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Correct | 1 ms | 328 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 0 ms | 328 KB | Ok |
5 | Correct | 1 ms | 212 KB | Ok |
6 | Correct | 0 ms | 212 KB | Ok |
7 | Correct | 1 ms | 212 KB | Ok |
8 | Correct | 0 ms | 328 KB | Ok |
9 | Correct | 1 ms | 328 KB | Ok |
10 | Correct | 0 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Jury has the better answer : jans = 5, pans = 4 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Ok |
2 | Correct | 1 ms | 332 KB | Ok |
3 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 5, pans = 4 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 6, pans = 5 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Correct | 1 ms | 328 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 0 ms | 328 KB | Ok |
5 | Correct | 1 ms | 212 KB | Ok |
6 | Correct | 0 ms | 212 KB | Ok |
7 | Correct | 1 ms | 212 KB | Ok |
8 | Correct | 0 ms | 328 KB | Ok |
9 | Correct | 1 ms | 328 KB | Ok |
10 | Correct | 0 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
13 | Correct | 1 ms | 332 KB | Ok |
14 | Correct | 1 ms | 332 KB | Ok |
15 | Incorrect | 1 ms | 212 KB | Jury has the better answer : jans = 5, pans = 4 |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Correct | 1 ms | 328 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 0 ms | 328 KB | Ok |
5 | Correct | 1 ms | 212 KB | Ok |
6 | Correct | 0 ms | 212 KB | Ok |
7 | Correct | 1 ms | 212 KB | Ok |
8 | Correct | 0 ms | 328 KB | Ok |
9 | Correct | 1 ms | 328 KB | Ok |
10 | Correct | 0 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
13 | Incorrect | 0 ms | 212 KB | Jury has the better answer : jans = 5, pans = 4 |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Ok |
2 | Correct | 1 ms | 328 KB | Ok |
3 | Correct | 1 ms | 212 KB | Ok |
4 | Correct | 0 ms | 328 KB | Ok |
5 | Correct | 1 ms | 212 KB | Ok |
6 | Correct | 0 ms | 212 KB | Ok |
7 | Correct | 1 ms | 212 KB | Ok |
8 | Correct | 0 ms | 328 KB | Ok |
9 | Correct | 1 ms | 328 KB | Ok |
10 | Correct | 0 ms | 212 KB | Ok |
11 | Correct | 1 ms | 212 KB | Ok |
12 | Correct | 1 ms | 212 KB | Ok |
13 | Incorrect | 0 ms | 212 KB | Jury has the better answer : jans = 5, pans = 4 |
14 | Halted | 0 ms | 0 KB | - |