# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549299 | 2022-04-15T15:02:09 Z | krit3379 | Red-blue table (IZhO19_stones) | C++17 | 96 ms | 3956 KB |
#include<bits/stdc++.h> using namespace std; #define N 1005 int board[N][N],cnt[N]; priority_queue<pair<int,int>> q; void sol(){ int n,m,nn,mm,ma,ans,a,i,j,cou; scanf("%d %d",&n,&m); nn=n/2+1; mm=m/2+1; ans=0,ma=a=n; for(i=1;i<=n;i++){ for(j=1;j<=m;j++)board[i][j]=0; cnt[i]=m; } for(i=1;i<=m;i++){ for(j=1;j<=n;j++){ q.push({cnt[j],j}); } cou=nn; while(!q.empty()&&cou>0){ auto [x,y]=q.top(); q.pop(); if(--cnt[y]<mm)a--; board[y][i]=1; cou--; } if(a+i>ma)ma=a+i,ans=i; while(!q.empty())q.pop(); } printf("%d\n",ma); for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ if(j<=ans)printf("%c",board[i][j]?'-':'+'); else printf("+"); } printf("\n"); } } int main(){ int t; scanf("%d",&t); while(t--)sol(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Wrong answer in test 1 3: 2 < 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 468 KB | Wrong answer in test 3 45: 36 < 46 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Wrong answer in test 1 3: 2 < 3 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 93 ms | 1676 KB | Wrong answer in test 23 57: 76 < 78 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 96 ms | 1812 KB | Output is correct |
2 | Correct | 96 ms | 3956 KB | Output is correct |
3 | Correct | 84 ms | 3288 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Wrong answer in test 1 3: 2 < 3 |
2 | Halted | 0 ms | 0 KB | - |