# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
426487 |
2021-06-14T05:18:28 Z |
조영욱(#7645) |
City (JOI17_city) |
C++14 |
|
212 ms |
27152 KB |
#include "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
int sz[250000];
int ind[250000];
vector<int> adj[250000];
int f=0;
void dfs(int v,int prev){
ind[v]=f++;
sz[v]=1;
for(int i=0;i<adj[v].size();i++) {
int nt=adj[v][i];
if (nt==prev){
continue;
}
dfs(nt,v);
sz[v]+=sz[nt];
}
}
void Encode(int n, int A[], int B[])
{
for(int i=0;i<n-1;i++) {
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0,-1);
for (int i = 0; i < n; ++i) {
Code(i, sz[i]*250000+ind[i]);
}
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
void InitDevice()
{
}
int Answer(long long s,long long t)
{
int ssz=s/250000;
int sind=s%250000;
int tsz=t/250000;
int tind=t%250000;
if (sind>=tind&&sind<tind+tsz) {
return 0;
}
if (tind>=sind&&tind<sind+ssz) {
return 1;
}
return 2;
}
Compilation message
Encoder.cpp: In function 'void dfs(int, int)':
Encoder.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
13 | for(int i=0;i<adj[v].size();i++) {
| ~^~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
6396 KB |
Output is correct |
2 |
Correct |
4 ms |
6496 KB |
Output is correct |
3 |
Correct |
5 ms |
6396 KB |
Output is correct |
4 |
Correct |
5 ms |
6400 KB |
Output is correct |
5 |
Correct |
5 ms |
6400 KB |
Output is correct |
6 |
Correct |
4 ms |
6408 KB |
Output is correct |
7 |
Correct |
5 ms |
6400 KB |
Output is correct |
8 |
Correct |
5 ms |
6400 KB |
Output is correct |
9 |
Correct |
6 ms |
6476 KB |
Output is correct |
10 |
Correct |
6 ms |
6512 KB |
Output is correct |
11 |
Correct |
4 ms |
6408 KB |
Output is correct |
12 |
Correct |
5 ms |
6400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
210 ms |
21976 KB |
Output is correct - L = 175000000 |
2 |
Correct |
212 ms |
21808 KB |
Output is correct - L = 174750000 |
3 |
Correct |
206 ms |
22000 KB |
Output is correct - L = 175000000 |
4 |
Correct |
212 ms |
21920 KB |
Output is correct - L = 175000000 |
5 |
Incorrect |
212 ms |
27152 KB |
Wrong Answer [3] |
6 |
Halted |
0 ms |
0 KB |
- |