# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
426488 |
2021-06-14T05:19:31 Z |
조영욱(#7645) |
City (JOI17_city) |
C++14 |
|
575 ms |
53440 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]*250000LL+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++) {
| ~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
6396 KB |
Output is correct |
2 |
Correct |
5 ms |
6396 KB |
Output is correct |
3 |
Correct |
4 ms |
6396 KB |
Output is correct |
4 |
Correct |
4 ms |
6396 KB |
Output is correct |
5 |
Correct |
5 ms |
6396 KB |
Output is correct |
6 |
Correct |
4 ms |
6396 KB |
Output is correct |
7 |
Correct |
5 ms |
6404 KB |
Output is correct |
8 |
Correct |
4 ms |
6408 KB |
Output is correct |
9 |
Correct |
4 ms |
6396 KB |
Output is correct |
10 |
Correct |
4 ms |
6396 KB |
Output is correct |
11 |
Correct |
4 ms |
6404 KB |
Output is correct |
12 |
Correct |
4 ms |
6396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
198 ms |
15060 KB |
Output is correct - L = 175000000 |
2 |
Correct |
197 ms |
14956 KB |
Output is correct - L = 174750000 |
3 |
Correct |
199 ms |
14888 KB |
Output is correct - L = 175000000 |
4 |
Correct |
203 ms |
15008 KB |
Output is correct - L = 175000000 |
5 |
Partially correct |
525 ms |
45744 KB |
Output is partially correct - L = 62500000000 |
6 |
Partially correct |
506 ms |
52516 KB |
Output is partially correct - L = 62500000000 |
7 |
Partially correct |
519 ms |
52516 KB |
Output is partially correct - L = 62500000000 |
8 |
Partially correct |
496 ms |
52192 KB |
Output is partially correct - L = 62500000000 |
9 |
Partially correct |
407 ms |
53376 KB |
Output is partially correct - L = 62500000000 |
10 |
Partially correct |
452 ms |
53440 KB |
Output is partially correct - L = 62500000000 |
11 |
Partially correct |
426 ms |
53428 KB |
Output is partially correct - L = 62500000000 |
12 |
Partially correct |
417 ms |
53392 KB |
Output is partially correct - L = 62500000000 |
13 |
Partially correct |
499 ms |
52996 KB |
Output is partially correct - L = 62500000000 |
14 |
Partially correct |
517 ms |
52600 KB |
Output is partially correct - L = 62500000000 |
15 |
Correct |
204 ms |
21956 KB |
Output is correct - L = 175000000 |
16 |
Correct |
208 ms |
21940 KB |
Output is correct - L = 175000000 |
17 |
Correct |
197 ms |
21920 KB |
Output is correct - L = 175000000 |
18 |
Partially correct |
488 ms |
52668 KB |
Output is partially correct - L = 62500000000 |
19 |
Partially correct |
532 ms |
52476 KB |
Output is partially correct - L = 62500000000 |
20 |
Partially correct |
503 ms |
52752 KB |
Output is partially correct - L = 62500000000 |
21 |
Partially correct |
541 ms |
52744 KB |
Output is partially correct - L = 62500000000 |
22 |
Partially correct |
548 ms |
52688 KB |
Output is partially correct - L = 62500000000 |
23 |
Partially correct |
474 ms |
52628 KB |
Output is partially correct - L = 62500000000 |
24 |
Partially correct |
508 ms |
52708 KB |
Output is partially correct - L = 62500000000 |
25 |
Partially correct |
575 ms |
52516 KB |
Output is partially correct - L = 62500000000 |
26 |
Partially correct |
498 ms |
52556 KB |
Output is partially correct - L = 62500000000 |
27 |
Partially correct |
504 ms |
52692 KB |
Output is partially correct - L = 62500000000 |