#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pll pair<ll,ll>
#define F first
#define S second
std::vector<std::pair<int,int>> Alice();
long long setN(int n);
long long Bob(std::vector<std::pair<int,int>> V);
const ll nodes=5000;
std::vector<std::pair<int,int>> Alice(){
long long x1 = setN(nodes);
pll x={x1/nodes,x1%nodes};
if(x.S==0)x.S=nodes;
if(x.F==0)x.F=nodes;
std::vector<std::pair<int,int>> r={};
for(int i=1;i<=nodes/2;i++) if(x.F!=i && x.S!=i)r.push_back({x.F,i});
for(int i=nodes/2+1;i<=nodes;i++)if(x.F!=i && x.S!=i)r.push_back({x.S,i});
return r;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pll pair<ll,ll>
#define F first
#define S second
std::vector<std::pair<int,int>> Alice();
long long setN(int n);
long long Bob(std::vector<std::pair<int,int>> V);
const ll nodes=5000;
long long Bob(std::vector<std::pair<int,int>> V){
map<ll,ll> mp;pll r{-1,-1};
for(int i=0;i<V.size();i++){
mp[V[i].first]++;mp[V[i].second]++;
if(mp[V[i].F]==2)if(r.F==-1)r.F=V[i].F;else r.S=V[i].F;
if(mp[V[i].S]==2)if(r.F==-1)r.F=V[i].F;else r.S=V[i].F;
}
for(int i=0;i<V.size();i++){
if(V[i].F==r.F || V[i].F==r.S)swap(V[i].F,V[i].S);
if(V[i].F<=nodes/2 && V[i].S!=r.F)swap(r.F,r.S);
}
r.F%=nodes;r.S%=nodes;
ll ans=r.F*nodes+r.S;
if(ans==0)ans=nodes*nodes;
return ans;
}
Compilation message
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:15:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i=0;i<V.size();i++){
| ~^~~~~~~~~
Bob.cpp:17:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
17 | if(mp[V[i].F]==2)if(r.F==-1)r.F=V[i].F;else r.S=V[i].F;
| ^
Bob.cpp:18:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
18 | if(mp[V[i].S]==2)if(r.F==-1)r.F=V[i].F;else r.S=V[i].F;
| ^
Bob.cpp:20:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
20 | for(int i=0;i<V.size();i++){
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |