Submission #1009431

#TimeUsernameProblemLanguageResultExecution timeMemory
1009431hmm789City (JOI17_city)C++14
Compilation error
0 ms0 KiB
#include "Encoder.h" #include <bits/stdc++.h> using namespace std; #define int long long vector<int> adj[500000]; int pre[500000], len[500000], pw[300], cur; const double r = 1.05; void dfs(int x, int p) { pre[x] = cur++; for(int i : adj[x]) if(i != p) dfs(i, x); int sz = cur-pre[x]+1; len[x] = lower_bound(pw, pw+300, sz)-pw; cur += pw[len[x]] - sz; } #undef int void Encode(int N, int A[], int B[]) { #define int long long double num = 1; pw[0] = 1; for(int i = 1; i < 300; i++) { num *= r; pw[i] = (int)ceil(num); } 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, len[i]+300*pre[i]); #undef int }
#include "Device.h" #include <bits/stdc++.h> using namespace std; #define int long long int pw[300]; void InitDevice() { double num = 1; pw[0] = 1; for(int i = 1; i < 300; i++) { num *= r; pw[i] = (int)ceil(num); } } int Answer(long long S, long long T) { #define int long long int pres = S/300, posts = pres+pw[S%300]; int pret = T/300, postt = pret+pw[T%300]; if(pres < pret && posts >= postt) return 1; if(pret < pres && postt >= posts) return 0; return 2; #undef int }

Compilation message (stderr)

Device.cpp: In function 'void InitDevice()':
Device.cpp:12:16: error: 'r' was not declared in this scope
   12 |         num *= r;
      |                ^
Device.cpp: At global scope:
Device.cpp:17:5: error: ambiguating new declaration of 'long long int Answer(long long int, long long int)'
   17 | int Answer(long long S, long long T) {
      |     ^~~~~~
In file included from Device.cpp:1:
Device.h:2:5: note: old declaration 'int Answer(long long int, long long int)'
    2 | int Answer(long long S, long long T);
      |     ^~~~~~