Submission #557300

# Submission time Handle Problem Language Result Execution time Memory
557300 2022-05-05T05:54:21 Z ismoilov Toll (BOI17_toll) C++14
0 / 100
25 ms 2360 KB
#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] > 1e16)
			cout << "-1\n";
		else
			cout << pr[b] - pr[a] << "\n";
	}
}
int main()
{
	IOS;
	S();
}

Compilation message

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 time Memory Grader output
1 Correct 21 ms 1636 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 2360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1636 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 340 KB Output isn't correct
6 Halted 0 ms 0 KB -