제출 #383175

#제출 시각아이디문제언어결과실행 시간메모리
383175kshitij_sodaniCity (JOI17_city)C++14
22 / 100
528 ms57428 KiB
//#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define a first #define b second #define endl '\n' #include "Encoder.h" vector<llo> adj[250001]; llo co=0; llo st[250001]; llo endd[250001]; void dfs(llo no,llo par2=-1){ st[no]=co; for(auto j:adj[no]){ if(j!=par2){ dfs(j,no); } } co++; endd[no]=co-1; } void Encode(int n, int aa[], int bb[]) { for(int i=0;i<n-1;i++){ adj[aa[i]].pb(bb[i]); adj[bb[i]].pb(aa[i]); } dfs(0); for (int i = 0; i < n; ++i) { Code(i, st[i]*250000+endd[i]); } }
//#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define a first #define b second #define endl '\n' #include "Device.h" void InitDevice() { } int Answer(long long S, long long T) { llo xx2=250000; pair<llo,llo> xx={S/xx2,S%xx2}; pair<llo,llo> yy={T/xx2,T%xx2}; //0 if T is parent of S //1 if S is parent of T if(yy.a>=xx.a and yy.b<=xx.b){ return 1; } if(yy.a<=xx.a and yy.b>=xx.b){ return 0; } return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...