Submission #348517

#TimeUsernameProblemLanguageResultExecution timeMemory
348517arnold518Information (CEOI08_information)C++14
46 / 100
1093 ms20204 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2000; const int MAXM = 1e6; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); int N, M; pii E[MAXM+10]; vector<pii> adj[MAXN+10]; int chk[MAXM+10]; bool vis[MAXN+10]; void dfs(int now, int col) { vis[now]=true; for(pii nxt : adj[now]) { if(chk[nxt.second]) continue; if(vis[nxt.first]) continue; chk[nxt.second]=col; dfs(nxt.first, col); } } int main() { scanf("%d%d", &N, &M); for(int i=1; i<=M; i++) { int u, v; scanf("%d%d", &u, &v); E[i]={u, v}; adj[u].push_back({v, i}); } for(int k=1; k<=100; k++) { memset(vis, 0, sizeof(vis)); dfs(1, 1); memset(vis, 0, sizeof(vis)); dfs(1, 2); vector<int> V1, V2; for(int i=1; i<=M; i++) { if(chk[i]==1) V1.push_back(i); else if(chk[i]==2) V2.push_back(i); } for(int i=1; i<=N; i++) shuffle(adj[i].begin(), adj[i].end(), rng); if(V1.size()!=N-1 || V2.size()!=N-1) continue; for(auto it : V1) printf("%d ", it); printf("\n"); for(auto it : V2) printf("%d ", it); printf("\n"); return 0; } printf("NONE\n"); }

Compilation message (stderr)

information.cpp: In function 'int main()':
information.cpp:59:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   59 |   if(V1.size()!=N-1 || V2.size()!=N-1) continue;
      |      ~~~~~~~~~^~~~~
information.cpp:59:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   59 |   if(V1.size()!=N-1 || V2.size()!=N-1) continue;
      |                        ~~~~~~~~~^~~~~
information.cpp:60:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   60 |   for(auto it : V1) printf("%d ", it); printf("\n");
      |   ^~~
information.cpp:60:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   60 |   for(auto it : V1) printf("%d ", it); printf("\n");
      |                                        ^~~~~~
information.cpp:61:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   61 |   for(auto it : V2) printf("%d ", it); printf("\n");
      |   ^~~
information.cpp:61:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   61 |   for(auto it : V2) printf("%d ", it); printf("\n");
      |                                        ^~~~~~
information.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |  scanf("%d%d", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~
information.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |   scanf("%d%d", &u, &v);
      |   ~~~~~^~~~~~~~~~~~~~~~
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...