# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337453 | 2020-12-20T21:34:11 Z | scales | Red-blue table (IZhO19_stones) | C++17 | 85 ms | 9196 KB |
#include <bits/stdc++.h> /*#ifndef LOCAL_RUN #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #pragma GCC target("avx2,tune=native") #endif*/ ////////////////////BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB using namespace std; long long a[1000][1000]; int main() { ios::sync_with_stdio(false); cin.tie(0); //freopen("","r",stdin); //freopen("","w",stdout); long long t,i,j,mini,x,y,z,q,m,l,r,k,kol,x1,tip,g,maxi,n,y1; cin>>t; for(q=0;q<t;q++) { cin>>n; cin>>m; z=0; if(n>m) { z=1; swap(m,n); } kol=n*m-m*(n/2+1); kol=kol/(m/2+1); cout<<m+kol<<endl; for(i=0;i<n;i++) { for(j=0;j<m;j++) { a[i][j]=0; } } i=0; j=0; g=kol*(m/2+1); while(g!=0) { if(a[i][j]==0) { g--; a[i][j]=1; i++; j++; i=i%kol; j=j%m; } else { j++; j=j%m; } } if(z==0) { for(i=0;i<n;i++) { for(j=0;j<m;j++) { if(a[i][j]==1) { cout<<'+'; } else { cout<<'-'; } } cout<<endl; } } else { for(j=0;j<m;j++) { for(i=0;i<n;i++) { if(a[i][j]==0) { cout<<'+'; } else { cout<<'-'; } } cout<<endl; } } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 10 ms | 364 KB | Output is correct |
4 | Correct | 19 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 85 ms | 1772 KB | Output is correct |
2 | Correct | 42 ms | 7148 KB | Output is correct |
3 | Correct | 43 ms | 7168 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 2028 KB | Output is correct |
2 | Correct | 38 ms | 6764 KB | Output is correct |
3 | Correct | 36 ms | 5612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 10 ms | 364 KB | Output is correct |
4 | Correct | 19 ms | 364 KB | Output is correct |
5 | Correct | 85 ms | 1772 KB | Output is correct |
6 | Correct | 42 ms | 7148 KB | Output is correct |
7 | Correct | 43 ms | 7168 KB | Output is correct |
8 | Correct | 60 ms | 2028 KB | Output is correct |
9 | Correct | 38 ms | 6764 KB | Output is correct |
10 | Correct | 36 ms | 5612 KB | Output is correct |
11 | Correct | 41 ms | 748 KB | Output is correct |
12 | Correct | 39 ms | 5356 KB | Output is correct |
13 | Correct | 42 ms | 5120 KB | Output is correct |
14 | Correct | 32 ms | 3820 KB | Output is correct |
15 | Correct | 46 ms | 9196 KB | Output is correct |
16 | Correct | 36 ms | 7404 KB | Output is correct |
17 | Correct | 17 ms | 4460 KB | Output is correct |