# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
102456 | BanFcc | Sajam (COCI18_sajam) | C++14 | 85 ms | 5376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define debug(x) cerr<<#x<<" = "<<(x)<<endl
#define eps 1e-8
#define pi acos(-1.0)
using namespace std;
void test(){cerr<<"\n";}
template<typename T,typename... Args>void test(T x,Args... args){cerr<<x<<" ";test(args...);}
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAXN=(int)1e5+5;
const int MOD=(int)1e9+7;
char str[1005];
bitset<1005>b[1005];
int a[1005][1005];
int main()
{
int n,k;
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++){
scanf("%s",str);
for(int j=0;j<n;j++){
b[i][j]=(str[j]=='o');
}
}
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
a[i][j]=a[j][i]=n-(b[i]^b[j]).count();
}
}
int flag=0;
for(int i=1;i<=n;i++){
int stp=0;
for(int j=1;j<=n;j++){
if(i==j)continue;
stp+=min(n-a[i][j],a[i][j]);
}
if(stp<=k){
flag=1;
break;
}
}
if(k==n&&flag==0){
for(int i=0;i<n;i++){
int f=1;
for(int j=2;j<=n;j++){
int tmp=a[1][j];
if(b[1][i]!=b[j][i])tmp++;
else tmp--;
if(tmp!=1&&tmp!=n-1)f=0;
}
if(f){
flag=1;
break;
}
}
}
if(flag)printf("DA\n");
else printf("NE\n");
return 0;
}
컴파일 시 표준 에러 (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... |