Submission #584824

#TimeUsernameProblemLanguageResultExecution timeMemory
584824HuyToll (BOI17_toll)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#define int long long #define pii pair<int,ll> #define fi first #define se second /*#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma")*/ using namespace std; using ll = long long; using ull = unsigned long long; using ldb = long double; const ll N = (int)1e9 + 1; const int maxN = (int)5e4 + 1; const int mod = 1e9 + 7; //const int mod = 998244353; const int infty = 2e9 + 7; const int base = (int)4e5; void InputFile() { //freopen("scrivener.inp","r",stdin); //freopen("scrivener.out","w",stdout); //freopen("test.out","r",stdin); } void FastInput() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } struct TEdge { int a,b,t; bool operator > (TEdge other) { return (t < other.t) } }; int k,n,m,o; int f[maxN][18][5]; int grp; map<pii,int> edg; void Read() { cin >> k >> n >> m >> o; grp = n / k; for(int i = 1;i <= m;i++) { int a,b,t; cin >> a >> b >> t; edg[{a,b}] = edg[{b,a}] = t; } } void Solve() { for(int i = n - 1;i >= 0;i--) { /// j = 0; for(int d = 0;d < k;d++) { int nxt = (i / k + 1) * k + d; if(edg.find(make_pair(i,nxt)) == edg.end()) d[i][0][d] = infty; else f[i][0][d] = edg[{i,nxt}]; } for(int j = 1;j <= (int)log2(grp);j++) { for(int d = 0;d < k;d++) { f[i][j][d] = infty; for(int d1 = 0;d1 < k;d1++) { int nxt = (i / k + (1<<(j-1))) * k + d1; f[i][j][d] = min(f[i][j][d],min(f[nxt][j-1][d],f[i][j-1][d1])); } } } } for(int i = 1;i <= o;i++) { int x,y; cin >> x >> y; if(x > y) cout << -1 <<'\n'; else { int dis = y / k - x / k; } } } void Debug() { } int32_t main() { FastInput(); //InputFile(); //int sub_type; //cin >> sub_type; //Sieve(); //Prepare(); int test; //cin >> test; test = 1; while(test--) //for(int prc = 1; prc <= test; prc++) { Read(); Solve(); //Debug(); } }

Compilation message (stderr)

toll.cpp: In member function 'bool TEdge::operator>(TEdge)':
toll.cpp:40:29: error: expected ';' before '}' token
   40 |         return (t < other.t)
      |                             ^
      |                             ;
   41 |     }
      |     ~                        
toll.cpp: In function 'void Solve()':
toll.cpp:68:58: error: invalid types 'int[int]' for array subscript
   68 |             if(edg.find(make_pair(i,nxt)) == edg.end()) d[i][0][d] = infty;
      |                                                          ^
toll.cpp:93:17: warning: unused variable 'dis' [-Wunused-variable]
   93 |             int dis = y / k - x / k;
      |                 ^~~