제출 #1080633

#제출 시각아이디문제언어결과실행 시간메모리
1080633thelegendary08City (JOI17_city)C++14
8 / 100
276 ms44424 KiB
#include "Encoder.h" #include<bits/stdc++.h> #define pb push_back #define ll long long #define vi vector<ll> #define vvi vector<vector<int>> #define vll vector<long long int> #define vvll vector<vector<long long int>> #define pii pair<int, int> #define vpii vector<pair<int, int>> #define vc vector<char> #define vvc vector<vector<char>> #define vb vector<bool> #define mii map<int,int> #define mll map<long long int, long long int> #define mivi map<int,vector<int>> #define f0r(i,n) for(int i=0;i<n;i++) #define FOR(i,k,n) for(int i=k;i<n;i++) using namespace std; const int mxn = 250005; vi order; vi adj[mxn]; vb vis(mxn, 0); vi sz(mxn, 0); vi code(mxn, 0); void dfs(int x){ if(vis[x])return; int cur = 1; vis[x] = 1; order.pb(x); vpii please; for(auto u : adj[x]){ please.pb({sz[u], u}); } sort(please.rbegin(), please.rend()); for(auto u : please){ dfs(u.second); } } int getsz(int x, int from){ int cur = 1; for(auto u : adj[x]){ if(u != from){ cur += getsz(u, x); } } sz[x] = cur; return cur; } void Encode(int n, int a[], int b[]) { f0r(i, n-1){ adj[a[i]].pb(b[i]); adj[b[i]].pb(a[i]); } getsz(0, -1); dfs(0); f0r(i, n){ code[order[i]] = i; } for (int i = 0; i < n; ++i) { ll c; if(sz[i] < 125000ll) c = 125000ll * code[i] + sz[i]; else c = 125000ll* 250000ll + 250000ll * code[i] + sz[i]; Code(i, c); //cout<<i<<' '<<sz[i]<<' '<<code[i]<<'\n'; } }
#include "Device.h" #define ll long long void InitDevice() { } int Answer(long long S, long long T) { ll szs, cs, szt, ct; //cout<<S<<' '<<T<<'\n'; if(S >= 250000ll * 125000ll){ S -= 250000ll * 125000ll; szs = S % 250000ll; cs = S / 250000ll; } else{ szs = S % 125000ll; cs = S / 125000ll; } if(T >= 250000ll * 125000ll){ T -= 250000ll * 125000ll; szt = T % 250000ll; ct = T / 250000ll; } else{ szt = T % 125000ll; ct = T/ 125000ll; } //cout<<cs<<' '<<ct<<' '<<szs<<' '<<szt<<'\n'; if(cs + szs > ct && ct > cs)return 1; if(ct + szt > cs && cs > ct)return 0; return 2; }

컴파일 시 표준 에러 (stderr) 메시지

Encoder.cpp: In function 'void dfs(int)':
Encoder.cpp:29:6: warning: unused variable 'cur' [-Wunused-variable]
   29 |  int cur = 1;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...