Submission #557304

#TimeUsernameProblemLanguageResultExecution timeMemory
557304ismoilovToll (BOI17_toll)C++14
0 / 100
28 ms724 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++) #define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--) #define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--) const int maxx = 5e4+5; ll pr[maxx]; void S() { int k, n, m, o; cin >> k >> n >> m >> o; fpp(i,0,n) pr[i] = 1e18; fp(i,0,m){ int a, b, t; cin >> a >> b >> t; pr[b] = t; } fp(i,0,n) pr[i+1] += pr[i]; while(o --){ int a, b; cin >> a >> b; if(pr[b] - pr[a] >= 1e18 || a >= b) cout << "-1\n"; else cout << pr[b] - pr[a] << "\n"; } } int main() { IOS; S(); }

Compilation message (stderr)

toll.cpp: In function 'void S()':
toll.cpp:7:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    7 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
toll.cpp:16:2: note: in expansion of macro 'fpp'
   16 |  fpp(i,0,n)
      |  ^~~
toll.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
toll.cpp:18:2: note: in expansion of macro 'fp'
   18 |  fp(i,0,m){
      |  ^~
toll.cpp:6:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    6 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
toll.cpp:23:2: note: in expansion of macro 'fp'
   23 |  fp(i,0,n)
      |  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...