Submission #315259

#TimeUsernameProblemLanguageResultExecution timeMemory
315259mosiashvililukaCity (JOI17_city)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "Encoder.h"
using namespace std;
const int N=250009;
int a,b,c,d,e,i,j,lf[250009],rg[250009],f[250009],tim;
vector <int> v[250009];
void dfs(int q, int w){
	tim++;
	lf[q]=rg[q]=tim;
	for(vector <int>::iterator it=v[q].begin(); it!=v[q].end(); it++){
		if((*it)==w) continue;
		dfs((*it),q);
		if(rg[q]<rg[(*it)]) rg[q]=rg[(*it)];
	}
}
void Encode(int n, int A[], int B[]){
	a=n;
	for(i=0; i<a-1; i++){
		v[A[i]+1].push_back(B[i]+1);
		v[B[i]+1].push_back(A[i]+1);
	}
	dfs(1,0);
	for(i=1; i<=a; i++) Code(i-1,lf[i]*N+rg[i]);
}
#include<bits/stdc++.h>
#include "Device.h"
using namespace std;
int l[4],r[4];
void InitDevice() {
    
}
void anc(int q, int w){
	if(l[q]<=l[w]&&r[q]>=r[w]) return 1; else return 0;
}
int Answer(long long S, long long T) {
    l[1]=S/N;r[1]=S%N;
    l[2]=T/N;r[2]=T%N;
    if(anc(1,2)) return 0;
    if(anc(2,1)) return 1;
    return 2;
}

Compilation message (stderr)

Device.cpp: In function 'void anc(int, int)':
Device.cpp:9:36: error: return-statement with a value, in function returning 'void' [-fpermissive]
    9 |  if(l[q]<=l[w]&&r[q]>=r[w]) return 1; else return 0;
      |                                    ^
Device.cpp:9:51: error: return-statement with a value, in function returning 'void' [-fpermissive]
    9 |  if(l[q]<=l[w]&&r[q]>=r[w]) return 1; else return 0;
      |                                                   ^
Device.cpp: In function 'int Answer(long long int, long long int)':
Device.cpp:12:12: error: 'N' was not declared in this scope
   12 |     l[1]=S/N;r[1]=S%N;
      |            ^
Device.cpp:14:11: error: could not convert 'anc(1, 2)' from 'void' to 'bool'
   14 |     if(anc(1,2)) return 0;
      |        ~~~^~~~~
      |           |
      |           void
Device.cpp:15:11: error: could not convert 'anc(2, 1)' from 'void' to 'bool'
   15 |     if(anc(2,1)) return 1;
      |        ~~~^~~~~
      |           |
      |           void