답안 #497660

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
497660 2021-12-23T13:20:36 Z Aktan 금 캐기 (IZhO14_divide) C++14
48 / 100
1000 ms 3144 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define ft first
#define sc second
using namespace std;
const int mod=1e9+7,INF=1e17;

int a[100005],b[100005],c[100005],dp[100005],dp1[100005];
main(){
   int n,ans=0,res=0;
   cin >> n;
   for(int i=1;i<=n;i++){
   	cin >> a[i] >> b[i] >> c[i];
	   	dp[i]=dp[i-1]+b[i];
	   	dp1[i]=dp1[i-1]+c[i];
   	ans+=b[i];
   }
   int tot=0;
   for(int i=1;i<=n;i++){
   	for(int j=i;j<=n;j++){
   		int k=a[j]-a[i];
   		if(dp1[j]-dp1[i-1]>=k){
   			tot=max(tot,dp[j]-dp[i-1]);
		}
	   }
   }
   cout << tot;
   
}

Compilation message

divide.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
divide.cpp: In function 'int main()':
divide.cpp:14:16: warning: unused variable 'res' [-Wunused-variable]
   14 |    int n,ans=0,res=0;
      |                ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 0 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 0 ms 300 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 308 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 4 ms 372 KB Output is correct
22 Correct 4 ms 376 KB Output is correct
23 Correct 17 ms 600 KB Output is correct
24 Correct 16 ms 608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 0 ms 300 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 308 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 4 ms 372 KB Output is correct
22 Correct 4 ms 376 KB Output is correct
23 Correct 17 ms 600 KB Output is correct
24 Correct 16 ms 608 KB Output is correct
25 Correct 17 ms 460 KB Output is correct
26 Correct 82 ms 800 KB Output is correct
27 Correct 70 ms 872 KB Output is correct
28 Execution timed out 1026 ms 3144 KB Time limit exceeded
29 Halted 0 ms 0 KB -