Submission #60949

# Submission time Handle Problem Language Result Execution time Memory
60949 2018-07-25T04:09:32 Z 정원준(#1763) City (JOI17_city) C++11
0 / 100
172 ms 19392 KB
#include "Encoder.h"
#include <bits/stdc++.h>
#define L long long

using namespace std;

void Code(int,long long);

int chk[250050];


vector<int>v[250050];
int order[250050],ordtop,lef[250050],rig[250050];


void dfs(int x){
	int i;
	order[x]=lef[x]=rig[x]=ordtop;
	ordtop++;
	for(i=0;i<v[x].size();i++)
	{
		if(!chk[v[x][i]])
		{
			chk[v[x][i]]=1;
			dfs(v[x][i]);
			lef[x]=min(lef[x],lef[v[x][i]]);
			rig[x]=max(rig[x],rig[v[x][i]]);
		}
	}
}



void Encode(int N,int A[],int B[]){
	int i;
	for(i=0;i<N-1;i++)
	{
		v[A[i]].push_back(B[i]);
		v[B[i]].push_back(A[i]);
	}
	chk[0]=1;
	dfs(0);
	for(i=0;i<N;i++)
	{
		Code(i,(L)lef[i]*(L)250010+(L)rig[i]);
	}
}
#include "Device.h"
#include <bits/stdc++.h>
#define L long long

using namespace std;

void InitDevice(){
	return;
}

int Answer(L S,L T){
	L lef1=S/250010,rig1=S%250010;
	L lef2=T/250010,rig2=T%250010;
	if(lef1<=lef2&&rig2<=rig1) return 1;
	if(lef2<=lef1&&rig1<=rig2) return 1;
	return 0;
}

Compilation message

Encoder.cpp: In function 'void dfs(int)':
Encoder.cpp:20:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<v[x].size();i++)
          ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 12544 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 172 ms 19392 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -