Submission #1285227

#TimeUsernameProblemLanguageResultExecution timeMemory
1285227goulthenPermutation Game (APIO25_permgame)C++20
Compilation error
0 ms0 KiB
#include "permgame.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = a; i <= b; ++i) #define pb push_back #define fi first #define se second int Alice(int m, int e, std::vector<int> u, std::vector<int> v, int n, std::vector<int> p) { int cnt = 0; rep(i,0,n-1) if (p[i]==i) cnt++; vector<int> deg(m); rep(i,0,e-1) deg[u[i]]++, deg[v[i]]++; rep(i,0,m-1) if(deg[i] > 2) return cnt; while(1){ pii cur = {-1,-1}; vector<bool> mk(n+1,0); rep(i,0,n-1) { if(mk[i]) continue; mk[i] = 1; int st = p[i],sz = 1; while (!mk[st]){ sz++; st = p[st]; } cur = max({sz,i}); } if(cur.fi < m) break; cnt++; vector<int> t; t.pb(cur.se); rep(i,1,m-1) { t.pb(p[t.back()]); } int j = Bob(t); swap(p[t[u[j]]], p[t[v[j]]]); } return cnt; }

Compilation message (stderr)

permgame.cpp: In function 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)':
permgame.cpp:19:9: error: 'pii' was not declared in this scope
   19 |         pii cur = {-1,-1};
      |         ^~~
permgame.cpp:30:13: error: 'cur' was not declared in this scope
   30 |             cur = max({sz,i});
      |             ^~~
permgame.cpp:32:12: error: 'cur' was not declared in this scope
   32 |         if(cur.fi < m) break;
      |            ^~~
permgame.cpp:36:14: error: 'cur' was not declared in this scope
   36 |         t.pb(cur.se);
      |              ^~~