#include<bits/stdc++.h>
#include "Alice.h"
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
using namespace std;
using ll=long long;
ll setN(ll n)
{
ll x;
cin >> x;
return x;
}
std::vector<std::pair<int,int>> Alice()
{
ll x = setN(5000);
vector<pii> tree;
for(int i=1; i<5000; i++) tree.push_back({x%i+1, i+1});
sort(all(tree));
return tree;
}
#include<bits/stdc++.h>
#include "Bob.h"
#define el '\n'
#define fi first
#define sc second
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
vector<pii> tree;
ll mod[5001];
//long long setN(int n)
//{
// cin >> x;
// return x;
//}
ll lcm(ll a, ll b)
{
return a*b/__gcd(a, b);
}
//std::vector<std::pair<int,int>> Alice()
//{
// // add your code here
//
// // change below into your code
// long long x = setN(5000);
//
// for(int i=1; i<5000; i++) tree.push_back({x%i+1, i+1});
// return tree;
//}
long long Bob(std::vector<std::pair<int,int>> V){
// add your code here
// change this into your code
for(int i=1;i<=5000;i++) mod[i]=-1;
for(auto x:V) mod[x.sc-1]=x.fi-1;
ll lcmm=1, ans=0;
for(int i=1;i<=5000;i++)
{
if(mod[i]==-1) continue;
while((ans%i)!=mod[i]) ans+=lcmm;
lcmm=lcm(lcmm, i);
}
// int ch=0;
// for(int i=1;i<=5000;i++)
// {
// if(mod[i]==-1) continue;
// if((x%i)!=mod[i]) ch=1;
// }
// if(ch==0) return ans;
// else return -1;
return ans;
}
//void sol()
//{
// Alice();
//// for(auto x:tree) cout << x.fi << ' ' << x.sc << el;
// cout << Bob(tree);
//}
//signed main()
//{
//// freopen("divisor.INP", "r", stdin);
//// freopen("divisor.OUT", "w", stdout);
// ios_base::sync_with_stdio(0);
// cin.tie(0);
// int t=1;
// //cin >> t;
// while(t--)
// {
// sol();
// }
//}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
820 KB |
Correct. |
2 |
Correct |
2 ms |
820 KB |
Correct. |
3 |
Correct |
2 ms |
824 KB |
Correct. |
4 |
Correct |
2 ms |
820 KB |
Correct. |
5 |
Correct |
2 ms |
1068 KB |
Correct. |
6 |
Correct |
2 ms |
820 KB |
Correct. |
7 |
Correct |
2 ms |
832 KB |
Correct. |
8 |
Correct |
2 ms |
820 KB |
Correct. |
9 |
Correct |
2 ms |
820 KB |
Correct. |
10 |
Correct |
2 ms |
824 KB |
Correct. |
11 |
Correct |
2 ms |
820 KB |
Correct. |
12 |
Correct |
2 ms |
824 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
820 KB |
Correct. |
2 |
Correct |
2 ms |
820 KB |
Correct. |
3 |
Correct |
2 ms |
824 KB |
Correct. |
4 |
Correct |
2 ms |
820 KB |
Correct. |
5 |
Correct |
2 ms |
1068 KB |
Correct. |
6 |
Correct |
2 ms |
820 KB |
Correct. |
7 |
Correct |
2 ms |
832 KB |
Correct. |
8 |
Correct |
2 ms |
820 KB |
Correct. |
9 |
Correct |
2 ms |
820 KB |
Correct. |
10 |
Correct |
2 ms |
824 KB |
Correct. |
11 |
Correct |
2 ms |
820 KB |
Correct. |
12 |
Correct |
2 ms |
824 KB |
Correct. |
13 |
Correct |
2 ms |
820 KB |
Correct. |
14 |
Correct |
2 ms |
820 KB |
Correct. |
15 |
Correct |
2 ms |
832 KB |
Correct. |
16 |
Correct |
2 ms |
820 KB |
Correct. |
17 |
Correct |
1 ms |
820 KB |
Correct. |
18 |
Correct |
1 ms |
1076 KB |
Correct. |
19 |
Correct |
2 ms |
820 KB |
Correct. |
20 |
Correct |
3 ms |
816 KB |
Correct. |
21 |
Correct |
2 ms |
820 KB |
Correct. |
22 |
Correct |
1 ms |
820 KB |
Correct. |
23 |
Correct |
1 ms |
820 KB |
Correct. |
24 |
Correct |
2 ms |
820 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
820 KB |
Correct. |
2 |
Correct |
2 ms |
820 KB |
Correct. |
3 |
Correct |
2 ms |
824 KB |
Correct. |
4 |
Correct |
2 ms |
820 KB |
Correct. |
5 |
Correct |
2 ms |
1068 KB |
Correct. |
6 |
Correct |
2 ms |
820 KB |
Correct. |
7 |
Correct |
2 ms |
832 KB |
Correct. |
8 |
Correct |
2 ms |
820 KB |
Correct. |
9 |
Correct |
2 ms |
820 KB |
Correct. |
10 |
Correct |
2 ms |
824 KB |
Correct. |
11 |
Correct |
2 ms |
820 KB |
Correct. |
12 |
Correct |
2 ms |
824 KB |
Correct. |
13 |
Correct |
2 ms |
820 KB |
Correct. |
14 |
Correct |
2 ms |
820 KB |
Correct. |
15 |
Correct |
2 ms |
832 KB |
Correct. |
16 |
Correct |
2 ms |
820 KB |
Correct. |
17 |
Correct |
1 ms |
820 KB |
Correct. |
18 |
Correct |
1 ms |
1076 KB |
Correct. |
19 |
Correct |
2 ms |
820 KB |
Correct. |
20 |
Correct |
3 ms |
816 KB |
Correct. |
21 |
Correct |
2 ms |
820 KB |
Correct. |
22 |
Correct |
1 ms |
820 KB |
Correct. |
23 |
Correct |
1 ms |
820 KB |
Correct. |
24 |
Correct |
2 ms |
820 KB |
Correct. |
25 |
Correct |
3 ms |
820 KB |
Correct. |
26 |
Correct |
2 ms |
824 KB |
Correct. |
27 |
Correct |
3 ms |
820 KB |
Correct. |
28 |
Correct |
2 ms |
820 KB |
Correct. |
29 |
Correct |
2 ms |
832 KB |
Correct. |
30 |
Correct |
2 ms |
996 KB |
Correct. |
31 |
Correct |
2 ms |
820 KB |
Correct. |
32 |
Correct |
1 ms |
820 KB |
Correct. |
33 |
Correct |
1 ms |
828 KB |
Correct. |
34 |
Correct |
3 ms |
828 KB |
Correct. |
35 |
Correct |
1 ms |
820 KB |
Correct. |
36 |
Correct |
2 ms |
820 KB |
Correct. |
37 |
Correct |
1 ms |
820 KB |
Correct. |
38 |
Correct |
1 ms |
816 KB |
Correct. |
39 |
Correct |
1 ms |
820 KB |
Correct. |
40 |
Correct |
2 ms |
832 KB |
Correct. |
41 |
Correct |
1 ms |
820 KB |
Correct. |
42 |
Correct |
2 ms |
824 KB |
Correct. |
43 |
Correct |
2 ms |
820 KB |
Correct. |
44 |
Correct |
1 ms |
820 KB |
Correct. |