제출 #991372

#제출 시각아이디문제언어결과실행 시간메모리
991372Khanhcsp2마술쇼 (APIO24_show)C++17
100 / 100
3 ms1076 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...