#include <bits/stdc++.h>
#include "Alice.h"
#define MAXN 5007
using namespace std;
int perm[MAXN],to[MAXN],ot[MAXN];
vector< pair<int,int> > edges;
vector< pair<int,int> > Alice(){
long long x = setN(5000);
int n=5000;
for(int i=1;i<=n;i++)perm[i]=i;
for(int i=1;i<=n;i++){
swap(perm[i],perm[(i*23+76)%n+1]);
}
for(int i=2;i<=n;i++){
to[i]=(i*12+72)%(i-1)+1;
if(to[i]>1)ot[i]=to[i]-1;
else ot[i]=2;
}
for(long long i=60;i>=0;i--){
if(((1LL<<i)&x)>0){
for(int f=2;f<=n;f++){
if(f%61==i)edges.push_back({perm[to[f]],perm[f]});
}
}else{
for(int f=2;f<=n;f++){
if(f%61==i)edges.push_back({perm[ot[f]],perm[f]});
}
}
}
random_shuffle(edges.begin(),edges.end());
return edges;
}
#include<bits/stdc++.h>
#include "Bob.h"
#define MAXN 5007
using namespace std;
int permm[MAXN],tot[MAXN];
int rev[MAXN];
long long ans;
long long Bob(vector< pair<int,int> > e){
int n=5000;
for(int i=1;i<=n;i++)permm[i]=i;
for(int i=1;i<=n;i++){
swap(permm[i],permm[(i*23+76)%n+1]);
}
for(int i=1;i<=n;i++)rev[permm[i]]=i;
for(int i=2;i<=n;i++)tot[i]=(i*12+72)%(i-1)+1;
for(int i=0;i<e.size();i++){
e[i].first=rev[e[i].first];
e[i].second=rev[e[i].second];
if(e[i].first>e[i].second)swap(e[i].first,e[i].second);
if(tot[e[i].second]==e[i].first){
ans|=(1LL<<(e[i].second%61));
}
}
return ans;
}
Compilation message
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(int i=0;i<e.size();i++){
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1076 KB |
Correct. |
2 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1076 KB |
Correct. |
2 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1076 KB |
Correct. |
2 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |