# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1094636 |
2024-09-30T07:35:18 Z |
irmuun |
Magic Show (APIO24_show) |
C++17 |
|
1 ms |
1040 KB |
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
vector<pair<int,int>>Alice(){
ll X=setN(100);
vector<pair<int,int>>g;
for(int i=1;i<100;i++){
if(X%(ll)i==0){
g.pb({i,100});
}
else{
g.pb({i,X%(ll)i});
}
}
return g;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
long long Bob(vector<pair<int,int>>g){
//Chinese remainder theorom...
ll N=100;
vector<pair<ll,ll>>rem;
for(auto [a,b]:g){
if(a>b) swap(a,b);
if(b==100){
rem.pb({a,0});
}
else{
rem.pb({b,a});
}
}
vector<ll>r(101,-1);
for(auto [a,b]:rem){
for(ll j=1;j<=100;j++){
if(a%j==0){
r[j]=b%j;
}
}
}
vector<bool>prime(N+1,1);
for(ll i=2;i<=N;i++){
if(prime[i]){
for(ll j=i+i;j<=N;j+=i){
prime[j]=false;
}
}
}
vector<pair<ll,ll>>cht;
for(ll i=2;i<=N;i++){
if(prime[i]){
ll cur=i,p=-1,q=-1;
while(cur<=N){
if(r[cur]>-1){
p=cur;
q=r[cur];
}
cur*=i;
}
if(p>0){
cht.pb({p,q});
}
}
}
assert(!cht.empty());
ll A=cht[0].ff,X=cht[0].ss;
ll inf=(ll)1e18;
for(ll i=1;i<cht.size();i++){
if(inf/cht[i].ff<A){
return X;
}
for(ll c=0;c<cht[i].ff;c++){
if((X+A*c)%cht[i].ff==cht[i].ss){
X=X+A*c;
break;
}
}
A*=cht[i].ff;
}
return X;
}
Compilation message
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:61:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
61 | for(ll i=1;i<cht.size();i++){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
776 KB |
Correct. |
2 |
Correct |
0 ms |
780 KB |
Correct. |
3 |
Correct |
0 ms |
776 KB |
Correct. |
4 |
Correct |
0 ms |
784 KB |
Correct. |
5 |
Correct |
0 ms |
784 KB |
Correct. |
6 |
Correct |
0 ms |
776 KB |
Correct. |
7 |
Correct |
1 ms |
776 KB |
Correct. |
8 |
Correct |
0 ms |
784 KB |
Correct. |
9 |
Correct |
0 ms |
776 KB |
Correct. |
10 |
Correct |
0 ms |
776 KB |
Correct. |
11 |
Correct |
0 ms |
784 KB |
Correct. |
12 |
Correct |
0 ms |
784 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
776 KB |
Correct. |
2 |
Correct |
0 ms |
780 KB |
Correct. |
3 |
Correct |
0 ms |
776 KB |
Correct. |
4 |
Correct |
0 ms |
784 KB |
Correct. |
5 |
Correct |
0 ms |
784 KB |
Correct. |
6 |
Correct |
0 ms |
776 KB |
Correct. |
7 |
Correct |
1 ms |
776 KB |
Correct. |
8 |
Correct |
0 ms |
784 KB |
Correct. |
9 |
Correct |
0 ms |
776 KB |
Correct. |
10 |
Correct |
0 ms |
776 KB |
Correct. |
11 |
Correct |
0 ms |
784 KB |
Correct. |
12 |
Correct |
0 ms |
784 KB |
Correct. |
13 |
Correct |
0 ms |
1040 KB |
Correct. |
14 |
Correct |
0 ms |
784 KB |
Correct. |
15 |
Correct |
0 ms |
780 KB |
Correct. |
16 |
Correct |
0 ms |
776 KB |
Correct. |
17 |
Correct |
0 ms |
784 KB |
Correct. |
18 |
Correct |
0 ms |
784 KB |
Correct. |
19 |
Correct |
0 ms |
776 KB |
Correct. |
20 |
Correct |
0 ms |
776 KB |
Correct. |
21 |
Correct |
0 ms |
776 KB |
Correct. |
22 |
Correct |
0 ms |
776 KB |
Correct. |
23 |
Correct |
1 ms |
776 KB |
Correct. |
24 |
Correct |
1 ms |
772 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
776 KB |
Correct. |
2 |
Correct |
0 ms |
780 KB |
Correct. |
3 |
Correct |
0 ms |
776 KB |
Correct. |
4 |
Correct |
0 ms |
784 KB |
Correct. |
5 |
Correct |
0 ms |
784 KB |
Correct. |
6 |
Correct |
0 ms |
776 KB |
Correct. |
7 |
Correct |
1 ms |
776 KB |
Correct. |
8 |
Correct |
0 ms |
784 KB |
Correct. |
9 |
Correct |
0 ms |
776 KB |
Correct. |
10 |
Correct |
0 ms |
776 KB |
Correct. |
11 |
Correct |
0 ms |
784 KB |
Correct. |
12 |
Correct |
0 ms |
784 KB |
Correct. |
13 |
Correct |
0 ms |
1040 KB |
Correct. |
14 |
Correct |
0 ms |
784 KB |
Correct. |
15 |
Correct |
0 ms |
780 KB |
Correct. |
16 |
Correct |
0 ms |
776 KB |
Correct. |
17 |
Correct |
0 ms |
784 KB |
Correct. |
18 |
Correct |
0 ms |
784 KB |
Correct. |
19 |
Correct |
0 ms |
776 KB |
Correct. |
20 |
Correct |
0 ms |
776 KB |
Correct. |
21 |
Correct |
0 ms |
776 KB |
Correct. |
22 |
Correct |
0 ms |
776 KB |
Correct. |
23 |
Correct |
1 ms |
776 KB |
Correct. |
24 |
Correct |
1 ms |
772 KB |
Correct. |
25 |
Incorrect |
0 ms |
776 KB |
Incorrect answer. |
26 |
Halted |
0 ms |
0 KB |
- |