| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 173458 | juggernaut | Red-blue table (IZhO19_stones) | C++14 | 33 ms | 2296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Just try and the idea will come!
#include<bits/stdc++.h>
using namespace std;
int t,n,m,cnt[1001];
bool a[1001][1001];
int run1(){
int res=m,i,j,last=1,cur,mid;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)a[i][j]=false,cnt[j]=n;
for(i=1;i<=n;i++){
cur=last;
mid=(m>>1)+1;
while(mid){
if(cnt[cur]>n/2+1){
cnt[cur]--;
a[i][cur]=true;
mid--;
}
cur++;
if(cur==m+1)cur=1;
if(cur==last)break;
}
if(mid==0)res++,last=cur;else break;
}
return res;
}
int run2(){
int res=n,i,j,last=1,cur,mid;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)a[i][j]=true,cnt[i]=m;
for(i=1;i<=m;i++){
cur=last;
mid=(n>>1)+1;
while(mid){
if(cnt[cur]>m/2+1){
cnt[cur]--;
a[cur][i]=false;
mid--;
}
cur++;
if(cur==n+1)cur=1;
if(cur==last)break;
}
if(mid==0)res++,last=cur;else break;
}
return res;
}
int main(){
scanf("%d",&t);
while(t--){
scanf("%d%d",&n,&m);
if(run1()>run2())printf("%d\n",run1());
else printf("%d\n",run2());
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++)if(a[i][j])putchar('+');
else putchar('-');
puts("");
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
