Submission #527155

#TimeUsernameProblemLanguageResultExecution timeMemory
527155hmm789Potemkin cycle (CEOI15_indcyc)C++14
10 / 100
1085 ms4460 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, e, a, b, ans = 0; cin >> n >> e; int adj[n][n]; memset(adj, 0, sizeof(adj)); for(int i = 0; i < e; i++) { cin >> a >> b; a--; b--; adj[a][b] = 1; adj[b][a] = 1; } vector<int> v; for(int i = 0; i < (1<<n); i++) { v.clear(); for(int j = 0; j < n; j++) { if(i & (1<<j)) v.push_back(j); } if(v.size() < 4) continue; int cnt[v.size()]; memset(cnt, 0, sizeof(cnt)); for(int i = 0; i < v.size(); i++) { for(int j = 0; j < v.size(); j++) { if(adj[v[i]][v[j]]) cnt[i]++; } } for(int i = 0; i < v.size(); i++) if(cnt[i] != 2) goto end2; ans++; break; end2:; } if(ans == 0) cout << "no"; else for(int i : v) cout << i+1 << " "; }

Compilation message (stderr)

indcyc.cpp: In function 'int main()':
indcyc.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for(int i = 0; i < v.size(); i++) {
      |                  ~~^~~~~~~~~~
indcyc.cpp:27:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |    for(int j = 0; j < v.size(); j++) {
      |                   ~~^~~~~~~~~~
indcyc.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   for(int i = 0; i < v.size(); i++) if(cnt[i] != 2) goto end2;
      |                  ~~^~~~~~~~~~
indcyc.cpp:24:7: warning: argument to variable-length array may be too large [-Wvla-larger-than=]
   24 |   int cnt[v.size()];
      |       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...