제출 #610564

#제출 시각아이디문제언어결과실행 시간메모리
6105641bin무제 (POI11_smi)C++14
20 / 100
808 ms63544 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 1e6 + 5; int n, m, a, b, s, t, w[NMAX], chk[NMAX], vis[NMAX], fin; vector<pair<int, int>> adj[NMAX]; vector<vector<int>> v; void dfs(int x, vector<int> & t){ t.emplace_back(x); if(vis[x]) { fin = 1; return; } vis[x] = 1; for(int& i = w[x]; i < adj[x].size(); i++){ auto& [nx, e] = adj[x][i]; if(chk[e]) continue; chk[e] = 1; dfs(nx, t); if(fin) { vis[x] = 0; return; } } return; } int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 0; i < m; i++){ cin >> a >> b >> s >> t; if(s ^ t) { adj[a].emplace_back(b, i); adj[b].emplace_back(a, i); } } for(int i = 1; i <= n; i++) if(adj[i].size() & 1){ cout << "NIE"; return 0; } for(int i = 1; i <= n; i++) if(w[i] < adj[i].size()){ vector<int> t; fin = 0; dfs(i, t); if(t.size() == 1) continue; v.emplace_back(t); } cout << v.size() << '\n'; for(auto& t : v){ cout << t.size()- 1 << ' '; for(int x : t) cout << x << ' '; cout << '\n'; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

smi.cpp: In function 'void dfs(int, std::vector<int>&)':
smi.cpp:18:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int& i = w[x]; i < adj[x].size(); i++){
      |                        ~~^~~~~~~~~~~~~~~
smi.cpp:19:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   19 |         auto& [nx, e] = adj[x][i];
      |               ^
smi.cpp: In function 'int main()':
smi.cpp:48:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         if(w[i] < adj[i].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...