답안 #951162

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951162 2024-03-21T09:30:52 Z Warinchai Ronald (COCI17_ronald) C++14
120 / 120
27 ms 4404 KB
#include<bits/stdc++.h>
using namespace std;
int vis[1005];
int edge[1005][1005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    int m;cin>>m;
    for(int i=1;i<=m;i++){
        int a,b;cin>>a>>b;
        edge[a][b]=1;
        edge[b][a]=1;
    }
    int check=1;
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(!vis[i]){
            cnt++;
            vis[i]=1;
            vector<int>v;
            for(int j=1;j<=n;j++)if(edge[i][j])v.push_back(j),vis[j]=1;
            for(auto x:v){
                for(int k=1;k<=n;k++){
                    if(k!=x&&k!=i){
                        if(edge[x][k]!=edge[i][k]){
                            check=0;
                            break;
                        }
                    }
                }
                if(!check)break;
            }
        }
        if(!check)break;
    }
    if(check&&cnt<=2)cout<<"DA";
    else cout<<"NE";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 9 ms 2696 KB Output is correct
3 Correct 3 ms 2652 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 4 ms 2652 KB Output is correct
3 Correct 17 ms 4400 KB Output is correct
4 Correct 27 ms 4404 KB Output is correct