Submission #954407

#TimeUsernameProblemLanguageResultExecution timeMemory
954407ArtieAaronAirline Route Map (JOI18_airline)C++14
0 / 100
361 ms11000 KiB
#include <bits/stdc++.h> #include "Alicelib.h" #include <cassert> #include <cstdio> using namespace std; #define vec vector typedef int lli; typedef pair<lli, lli> ii; typedef vec<lli> vi; typedef vec<ii> vii; typedef vec<vi> vvi; #define f first #define s second #define pb push_back #define sz(v) (v).size() #define mid lli((l + r)/2) #define all(v) sort((v).begin(), (v).end()) #define rall(v) sort((v).rbegin(), (v).rend()) #define SL '\n' #define fore(a,s,d) for(lli a = (s), asd = (d); a < asd; a++) #define wd(a,s,d) for(lli a = (s), asd = (d); a > asd; a --) #define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const lli NN = 1500; vi pd = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 }; void Alice(int N, int M, int A[], int B[]){ vi ans(N); lli pp = 512 + N; fore(i,0,N) ans[i] = pd[i]; fore(i,0,M){ lli a = A[i], b = B[i]; if(b > a) swap(a, b); ans[a] += pd[b]; } { lli mans = pp; for(auto i: ans) mans += i; InitG(1500, mans); } lli nw = 0; lli pos = 0; for(lli i = 0; i < N; i ++){ lli o = NN - i - 2; while(ans[i]--){ MakeG(pos, o, nw); nw ++, pos ++; } } while(pp--){ MakeG(pos, 1499, nw); nw ++, pos ++; } }
#include <bits/stdc++.h> #include "Boblib.h" #include <cassert> #include <cstdio> using namespace std; #define vec vector typedef int lli; typedef pair<lli, lli> ii; typedef vec<lli> vi; typedef vec<ii> vii; typedef vec<vi> vvi; #define f first #define s second #define pb push_back #define sz(v) (v).size() #define mid lli((l + r)/2) #define all(v) sort((v).begin(), (v).end()) #define rall(v) sort((v).rbegin(), (v).rend()) #define SL '\n' #define fore(a,s,d) for(lli a = (s), asd = (d); a < asd; a++) #define wd(a,s,d) for(lli a = (s), asd = (d); a > asd; a --) #define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const lli NN = 1500; vi pd = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 }; void Bob(int V, int U, int C[], int D[]){ vi ans(V); fore(i,0,U){ ans[C[i]] ++; ans[D[i]] ++; } rall(ans); // for(auto i: ans) cout << i << ' '; cout << SL; lli nn = ans[0] - 512; vii aristas; for(lli i = nn-1; i >= 0; i --){ lli p = ans[nn - i]; // cout << i << ' '<< p << ' '; p -= pd[i]; // cout << p << SL; lli y = 0; while(p){ if(p&1){ aristas.pb(ii({i, y})); // cout << y << ' '; } // cout << "p: " << p << ' '; p >>= 1; y ++; } // cout << SL; } InitMap(nn, sz(aristas)); for(auto i: aristas){ MakeMap(i.f, i.s); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...