#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]=(perm[i])%(i-1)+1;
if(to[i]>1)ot[i]=to[i]-1;
else ot[i]=2;
}
edges.push_back({perm[1],perm[2]});
for(long long i=60;i>=0;i--){
if(((1LL<<i)&x)>0){
for(int f=3;f<=n;f++){
if(f%61==i)edges.push_back({perm[to[f]],perm[f]});
}
}else{
for(int f=3;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]=(permm[i])%(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(e[i].second!=2 and 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 |
Correct |
1 ms |
1076 KB |
Correct. |
3 |
Correct |
2 ms |
1080 KB |
Correct. |
4 |
Correct |
2 ms |
1076 KB |
Correct. |
5 |
Correct |
2 ms |
1076 KB |
Correct. |
6 |
Correct |
3 ms |
1004 KB |
Correct. |
7 |
Correct |
1 ms |
1076 KB |
Correct. |
8 |
Correct |
1 ms |
1080 KB |
Correct. |
9 |
Correct |
1 ms |
1088 KB |
Correct. |
10 |
Correct |
2 ms |
1180 KB |
Correct. |
11 |
Correct |
2 ms |
1076 KB |
Correct. |
12 |
Correct |
2 ms |
1076 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1076 KB |
Correct. |
2 |
Correct |
1 ms |
1076 KB |
Correct. |
3 |
Correct |
2 ms |
1080 KB |
Correct. |
4 |
Correct |
2 ms |
1076 KB |
Correct. |
5 |
Correct |
2 ms |
1076 KB |
Correct. |
6 |
Correct |
3 ms |
1004 KB |
Correct. |
7 |
Correct |
1 ms |
1076 KB |
Correct. |
8 |
Correct |
1 ms |
1080 KB |
Correct. |
9 |
Correct |
1 ms |
1088 KB |
Correct. |
10 |
Correct |
2 ms |
1180 KB |
Correct. |
11 |
Correct |
2 ms |
1076 KB |
Correct. |
12 |
Correct |
2 ms |
1076 KB |
Correct. |
13 |
Correct |
3 ms |
1328 KB |
Correct. |
14 |
Correct |
1 ms |
1284 KB |
Correct. |
15 |
Correct |
1 ms |
1324 KB |
Correct. |
16 |
Correct |
2 ms |
1088 KB |
Correct. |
17 |
Correct |
1 ms |
1088 KB |
Correct. |
18 |
Correct |
2 ms |
1192 KB |
Correct. |
19 |
Correct |
1 ms |
1084 KB |
Correct. |
20 |
Correct |
1 ms |
1328 KB |
Correct. |
21 |
Correct |
1 ms |
1152 KB |
Correct. |
22 |
Correct |
2 ms |
1088 KB |
Correct. |
23 |
Correct |
2 ms |
1076 KB |
Correct. |
24 |
Correct |
1 ms |
1088 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1076 KB |
Correct. |
2 |
Correct |
1 ms |
1076 KB |
Correct. |
3 |
Correct |
2 ms |
1080 KB |
Correct. |
4 |
Correct |
2 ms |
1076 KB |
Correct. |
5 |
Correct |
2 ms |
1076 KB |
Correct. |
6 |
Correct |
3 ms |
1004 KB |
Correct. |
7 |
Correct |
1 ms |
1076 KB |
Correct. |
8 |
Correct |
1 ms |
1080 KB |
Correct. |
9 |
Correct |
1 ms |
1088 KB |
Correct. |
10 |
Correct |
2 ms |
1180 KB |
Correct. |
11 |
Correct |
2 ms |
1076 KB |
Correct. |
12 |
Correct |
2 ms |
1076 KB |
Correct. |
13 |
Correct |
3 ms |
1328 KB |
Correct. |
14 |
Correct |
1 ms |
1284 KB |
Correct. |
15 |
Correct |
1 ms |
1324 KB |
Correct. |
16 |
Correct |
2 ms |
1088 KB |
Correct. |
17 |
Correct |
1 ms |
1088 KB |
Correct. |
18 |
Correct |
2 ms |
1192 KB |
Correct. |
19 |
Correct |
1 ms |
1084 KB |
Correct. |
20 |
Correct |
1 ms |
1328 KB |
Correct. |
21 |
Correct |
1 ms |
1152 KB |
Correct. |
22 |
Correct |
2 ms |
1088 KB |
Correct. |
23 |
Correct |
2 ms |
1076 KB |
Correct. |
24 |
Correct |
1 ms |
1088 KB |
Correct. |
25 |
Correct |
2 ms |
1088 KB |
Correct. |
26 |
Correct |
2 ms |
1088 KB |
Correct. |
27 |
Correct |
2 ms |
1084 KB |
Correct. |
28 |
Correct |
2 ms |
1092 KB |
Correct. |
29 |
Correct |
2 ms |
1076 KB |
Correct. |
30 |
Correct |
1 ms |
1076 KB |
Correct. |
31 |
Correct |
1 ms |
1076 KB |
Correct. |
32 |
Correct |
2 ms |
1088 KB |
Correct. |
33 |
Correct |
1 ms |
1076 KB |
Correct. |
34 |
Correct |
2 ms |
1088 KB |
Correct. |
35 |
Correct |
2 ms |
1076 KB |
Correct. |
36 |
Correct |
1 ms |
1088 KB |
Correct. |
37 |
Correct |
2 ms |
1076 KB |
Correct. |
38 |
Correct |
1 ms |
1076 KB |
Correct. |
39 |
Correct |
2 ms |
1328 KB |
Correct. |
40 |
Correct |
2 ms |
1088 KB |
Correct. |
41 |
Correct |
1 ms |
1076 KB |
Correct. |
42 |
Correct |
1 ms |
1076 KB |
Correct. |
43 |
Correct |
2 ms |
1088 KB |
Correct. |
44 |
Correct |
1 ms |
1076 KB |
Correct. |