| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 105131 | arthur_nascimento | Sajam (COCI18_sajam) | C++14 | 322 ms | 6484 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 1010
#define bs bitset<maxn>
#define debug
int ans = 0;
bs col[maxn];
char M[maxn][maxn];
int dif[maxn][maxn];
void go(int n,int k){
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
col[j].set(i,M[i][j] == 'x');
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
dif[i][j] = (col[i] ^ col[j]).count();
for(int j=0;j<n;j++){
int s = 0;
for(int jj=0;jj<n;jj++)
s += min(dif[j][jj],n-dif[j][jj]);
if(s <= k)
ans = 1;
}
debug("%d\n",ans);
}
int main(){
int n,k;
scanf("%d%d",&n,&k);
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
scanf(" %c",&M[i][j]);
go(n,k);
for(int i=0;i<n;i++)
for(int j=i;j<n;j++)
swap(M[i][j], M[j][i]);
go(n,k);
for(int i=0;i<n;i++){
int s = 1;
for(int j=1;j<n;j++){
int d = dif[0][j];
if(M[i][0] == M[i][j])
d++;
else
d--;
s += min(d,n-d);
}
if(s <= k){
ans = 1;
debug("i %d s %d\n",i,s);
}
}
if(ans)
printf("DA\n");
else
printf("NE\n");
}
컴파일 시 표준 에러 (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... | ||||
