Submission #116969

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1169692019-06-14 09:54:31tmwilliamlin168City (JOI17_city)C++14
100 / 100
596 ms56272 KiB
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN=2.5e5, B=1<<8;
vector<int> adj[mxN];
int s[mxN], dt1, dt2;
int encrange(int a, int b) {
return b*(b-1)/2+a;
}
void dfs2(int u) {
int ds=dt2++;
for(int v : adj[u])
dfs2(v);
Code(u, 1<<26|dt1<<15|encrange(ds, dt2));
}
void dfs1(int u=0, int p=-1, int d=0) {
int ds=dt1;
s[u]=1;
if(~p)
adj[u].erase(find(adj[u].begin(), adj[u].end(), p));
for(int v : adj[u]) {
dfs1(v, u, d+1);
s[u]+=s[v];
}
if(u&&s[u]<B)
return;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Encoder.cpp: In function 'void dfs1(int, int, int)':
Encoder.cpp:34:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0, cs; i<adj[u].size()&&s[adj[u][i]]<B; ++dt1) {
                   ~^~~~~~~~~~~~~~
Encoder.cpp:36:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(i<adj[u].size()&&cs+s[adj[u][i]]<B) {
         ~^~~~~~~~~~~~~~

Device.cpp: In function 'int Answer(long long int, long long int)':
Device.cpp:21:27: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   if((s>>15^t>>15)&(1<<11)-1)
                    ~~~~~~~^~
Device.cpp:23:38: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   array<int, 2> rs=decrange(s&(1<<15)-1), rt=decrange(t&(1<<15)-1);
                               ~~~~~~~^~
Device.cpp:23:64: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   array<int, 2> rs=decrange(s&(1<<15)-1), rt=decrange(t&(1<<15)-1);
                                                         ~~~~~~~^~
Device.cpp:31:22: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   int x=s>>15&(1<<11)-1;
               ~~~~~~~^~
Device.cpp:32:37: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   array<int, 2> r=decrange(t&(1<<21)-1);
                              ~~~~~~~^~
Device.cpp:36:22: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   int x=t>>15&(1<<11)-1;
               ~~~~~~~^~
Device.cpp:37:37: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
   array<int, 2> r=decrange(s&(1<<21)-1);
                              ~~~~~~~^~
Device.cpp:41:37: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
  array<int, 2> rs=decrange(s&(1<<21)-1), rt=decrange(t&(1<<21)-1);
                              ~~~~~~~^~
Device.cpp:41:63: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
  array<int, 2> rs=decrange(s&(1<<21)-1), rt=decrange(t&(1<<21)-1);
                                                        ~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...