Submission #996650

#TimeUsernameProblemLanguageResultExecution timeMemory
996650aintaMagic Show (APIO24_show)C++17
100 / 100
3 ms1080 KiB
#include <vector> #include "Alice.h" #include <bits/stdc++.h> using namespace std; #define rng(i,a,b) for(int i=int(a);i<=int(b);i++) #define rep(i,b) rng(i,0,b-1) #define gnr(i,b,a) for(int i=int(b);i>=int(a);i--) #define per(i,b) gnr(i,b-1,0) #define pb push_back #define eb emplace_back #define fi first #define se second #define bg begin() #define ed end() #define all(x) x.bg,x.ed #define si(x) int(x.size()) template<class t> using vc=vector<t>; template<class t> using vvc=vc<vc<t>>; typedef long long ll; using pii=pair<int,int>; using vi=vc<int>; using uint=unsigned; using ull=unsigned long long; using pil=pair<int,ll>; using pli=pair<ll,int>; using pll=pair<ll,ll>; using t3=tuple<int,int,int>; // you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables. // you had better not use the same global variables in function Alice() and in function Bob(). std::vector<std::pair<int,int>> Alice(){ mt19937 gen(1557); vi T; rng(i,1,6*666) T.pb(1000+i); shuffle(all(T), gen); int N = 1000 + 6*666; ll X = setN(N); vi Z(6); X--; rep(i,6){ Z[i] = X%1000; X/=1000; } vc<pii>res; rng(i,2,1000){ res.pb({1,i}); } rep(i,666){ rep(j,6){ res.pb({ (Z[j] + i)%1000 + 1, T[i*6+j]}); } } return res; }
#include <vector> #include "Bob.h" #include <bits/stdc++.h> using namespace std; #define rng(i,a,b) for(int i=int(a);i<=int(b);i++) #define rep(i,b) rng(i,0,b-1) #define gnr(i,b,a) for(int i=int(b);i>=int(a);i--) #define per(i,b) gnr(i,b-1,0) #define pb push_back #define eb emplace_back #define fi first #define se second #define bg begin() #define ed end() #define all(x) x.bg,x.ed #define si(x) int(x.size()) template<class t> using vc=vector<t>; template<class t> using vvc=vc<vc<t>>; typedef long long ll; using pii=pair<int,int>; using vi=vc<int>; using uint=unsigned; using ull=unsigned long long; using pil=pair<int,ll>; using pli=pair<ll,int>; using pll=pair<ll,ll>; using t3=tuple<int,int,int>; // you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables. // you had better not use the same global variables in function Alice() and in function Bob(). long long Bob(std::vector<std::pair<int,int>> V){ mt19937 gen(1557); vi T; vc<pii> U(5010); rng(i,1,6*666) T.pb(1000+i); shuffle(all(T), gen); rep(i,6*666){ U[T[i]]={i/6, i%6}; } int R[6]={0}; for(auto [a,b]: V){ if(a>1000){ swap(a,b); } if(b>1000){ R[U[b].se] = a-1-U[b].fi; while(R[U[b].se] < 0)R[U[b].se] += 1000; } } ll s=1,t=1; rep(i,6){ s += R[i]*t; t*=1000; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...