제출 #1274451

#제출 시각아이디문제언어결과실행 시간메모리
1274451hccoderPermutation Game (APIO25_permgame)C++20
30 / 100
3 ms348 KiB
#include <bits/stdc++.h> using namespace std; int Bob(std::vector<int> t); int Alice(int m, int e, std::vector<int> u, std::vector<int> v, int n, std::vector<int> p){ if (m==2){ map<int, int> mp; for (int i = 0; i<n; i++) mp[p[i]] = i; for (int i = 0; i<n; i++){ if (p[i]!=i){ int x = mp[i]; Bob({i, x}); mp[p[i]] = x; mp[i] = i; swap(p[i], p[x]); } } return n; } else if (m==3 && e==3){ int res = 0; vector<int> vis(n); for (int i = 0; i<n; i++){ int j = i; int cnt = 0; while (!vis[j]){ vis[j] = 1; j = p[j]; cnt++; } if (cnt & 1) res++; } for (int i = 0; i<10*n; i++){ for (int j = 0; j<n; j++){ int x = p[j]; int y = p[x]; int z = p[y]; if (x!=y && y!=z && x!=z) { vector<int> h{x, y, z}; int r = Bob(h); int a = h[v[r]], b = h[u[r]]; swap(p[a], p[b]); break; } } } return res; } }

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

permgame.cpp: In function 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)':
permgame.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
   51 | }
      | ^
#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...