Submission #76068

# Submission time Handle Problem Language Result Execution time Memory
76068 2018-09-12T03:05:57 Z thebes Party (POI11_imp) C++14
0 / 100
3000 ms 66560 KB
#include <bits/stdc++.h>
using namespace std;

const int MN = 3003;
int p[MN], n, m, i, x, y, deg[MN];
vector<int> adj[MN];

int main(){
    for(scanf("%d%d",&n,&m),i=1;i<=m;i++){
        scanf("%d%d",&x,&y);
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    for(i=1;i<=n;i++)
        p[i] = i;
    while(1){
        random_shuffle(p+1,p+n+1);
        memset(deg, 0, sizeof(deg));
        for(i=1;i<=n/3;i++){
            for(auto v : adj[p[i]])
                deg[v] ++;
        }
        bool fnd = 1;
        for(i=1;i<=n/3;i++){
            if(deg[p[i]] != n/3-1){
                fnd = 0;
                break;
            }
        }
        if(fnd){
            for(i=1;i<=n/3;i++)
                printf("%d ",p[i]);
            return 0;
        }
    }
}

Compilation message

imp.cpp: In function 'int main()':
imp.cpp:9:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(scanf("%d%d",&n,&m),i=1;i<=m;i++){
         ~~~~~~~~~~~~~~~~~~~^~~~
imp.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x,&y);
         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 15 ms 504 KB Output is correct
3 Execution timed out 3018 ms 740 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3043 ms 904 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3033 ms 1948 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3021 ms 3132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3043 ms 7640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3057 ms 22008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3046 ms 37688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3042 ms 56008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3034 ms 66560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3046 ms 66560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3042 ms 66560 KB Time limit exceeded
2 Halted 0 ms 0 KB -