# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1204881 | hackstar | Permutation Game (APIO25_permgame) | C++20 | Compilation error | 0 ms | 0 KiB |
#include "permgame.h"
#include <vector>
#include <utility>
#include<bits/stdc++.h>
using namespace std;
int Alice(int m, int e, std::vector<int> u, std::vector<int> v, int n, std::vector<int> p) {
auto calc=[&]()->int{
int cur=0;
for(int i=0;i<n;i++){
cur+=(p[i]==i);
}
return cur;
};
while(calc()!=n){
for(int i=0;i<n;i++){
if(p[i]!=i){
int id=Bob({i,p[i]});
swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]);
}
}
}
calc();
}#include "permgame.h"
#include <vector>
#include <utility>
#include<bits/stdc++.h>
using namespace std;
int Alice(int m, int e, std::vector<int> u, std::vector<int> v, int n, std::vector<int> p) {
auto calc=[&]()->int{
int cur=0;
for(int i=0;i<n;i++){
cur+=(p[i]==i);
}
return cur;
};
while(calc()!=n){
for(int i=0;i<n;i++){
if(p[i]!=i){
int id=Bob({i,p[i]});
swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]);
}
}
}
calc();
}
Compilation message (stderr)
permgame.cpp:25:2: error: stray '#' in program 25 | }#include "permgame.h" | ^ permgame.cpp: In function 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)': permgame.cpp:20:48: error: expected ']' before '[' token 20 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ | ] permgame.cpp:20:39: error: no match for 'operator[]' (operand types are 'std::vector<int>' and '<brace-enclosed initializer list>') 20 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ In file included from /usr/include/c++/11/vector:67, from permgame.h:1, from permgame.cpp:1: /usr/include/c++/11/bits/stl_vector.h:1043:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1043:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT | ~~~~~~~~~~^~~ /usr/include/c++/11/bits/stl_vector.h:1061:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1061:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT | ~~~~~~~~~~^~~ permgame.cpp:20:68: error: expected ',' before '[' token 20 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ | , permgame.cpp:20:68: error: expected identifier before '[' token permgame.cpp: In lambda function: permgame.cpp:20:72: error: expected '{' before ']' token 20 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ permgame.cpp: In function 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)': permgame.cpp:20:72: error: expected ';' before ']' token 20 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ | ; permgame.cpp:25:1: warning: no return statement in function returning non-void [-Wreturn-type] 25 | }#include "permgame.h" | ^ permgame.cpp: At global scope: permgame.cpp:25:3: error: 'include' does not name a type 25 | }#include "permgame.h" | ^~~~~~~ permgame.cpp:32:5: error: redefinition of 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)' 32 | int Alice(int m, int e, std::vector<int> u, std::vector<int> v, int n, std::vector<int> p) { | ^~~~~ permgame.cpp:8:5: note: 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)' previously defined here 8 | int Alice(int m, int e, std::vector<int> u, std::vector<int> v, int n, std::vector<int> p) { | ^~~~~ permgame.cpp: In function 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)': permgame.cpp:44:48: error: expected ']' before '[' token 44 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ | ] permgame.cpp:44:39: error: no match for 'operator[]' (operand types are 'std::vector<int>' and '<brace-enclosed initializer list>') 44 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ In file included from /usr/include/c++/11/vector:67, from permgame.h:1, from permgame.cpp:1: /usr/include/c++/11/bits/stl_vector.h:1043:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1043:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1043 | operator[](size_type __n) _GLIBCXX_NOEXCEPT | ~~~~~~~~~~^~~ /usr/include/c++/11/bits/stl_vector.h:1061:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/11/bits/stl_vector.h:1061:28: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1061 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT | ~~~~~~~~~~^~~ permgame.cpp:44:68: error: expected ',' before '[' token 44 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ | , permgame.cpp:44:68: error: expected identifier before '[' token permgame.cpp: In lambda function: permgame.cpp:44:72: error: expected '{' before ']' token 44 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ permgame.cpp: In function 'int Alice(int, int, std::vector<int>, std::vector<int>, int, std::vector<int>)': permgame.cpp:44:72: error: expected ';' before ']' token 44 | swap(p[{i,p[i]}[u[i]]],p[{i,p[i]}[v[i]]]); | ^ | ; permgame.cpp:49:1: warning: no return statement in function returning non-void [-Wreturn-type] 49 | } | ^