답안 #152975

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152975 2019-09-11T02:03:15 Z username Two Dishes (JOI19_dishes) C++14
5 / 100
216 ms 9948 KB
#pragma GCC optimize("O3")
#include<stdint.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define VIS(it,con) for(auto it=con.begin();it!=con.end();++it)
#define pob pop_back
#define pf push_front
#define pof pop_front
#define MIN(x,y) (x=min(x,(y)))
#define MAX(x,y) (x=max(x,(y)))
#define mid (l+r>>1)
#define lch (idx*2+1)
#define rch (idx*2+2)
/*****************************************************************************/
#include<bits/stdc++.h>
#define int int_fast64_t
using namespace std;
typedef pair<int,int> pii;
#define REP(i,j,k) for(int i=(j);i<(k);++i)
#define RREP(i,j,k) for(int i=int(j)-1;i>=(k);--i)
#define ALL(a) a.begin(),a.end()
#define pb push_back
#define f first
#define s second
#define endl '\n'
//																#define __debug
#ifdef __debug
	#define IOS (void)0
	#define de(...) cerr<<__VA_ARGS__
	#define ar(a,s,t) {REP(__i,s,t)de(a[__i]<<' ');de(endl);}
#else
	#define IOS cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false)
	#define de(...) (void)0
	#define ar(...) (void)0
#endif
/***********************************default***********************************/
const int maxn=1e6+9,inf=1ll<<60;
int n,m,a[maxn],b[maxn],s[maxn],t[maxn],p[maxn],q[maxn];

main(){
	IOS;
	cin>>n>>m;
	REP(i,0,n)cin>>a[i+1]>>s[i]>>p[i+1],a[i+1]+=a[i],p[i+1]+=p[i];
	REP(i,0,m)cin>>b[i+1]>>t[i]>>q[i+1],b[i+1]+=b[i],q[i+1]+=q[i];
	int res=-inf,it=m;
	REP(i,0,n+1){
		while(it&&a[i]+b[it]>s[0])--it;
		if(a[i]+b[it]<=s[0])MAX(res,p[i]+q[it]);
	}
	it=n;
	REP(i,0,m+1){
		while(it&&a[it]+b[i]>s[0])--it;
		if(a[it]+b[i]<=s[0])MAX(res,p[it]+q[i]);
	}
	cout<<res<<endl;
}

Compilation message

dishes.cpp:43:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 213 ms 9848 KB Output is correct
2 Correct 211 ms 9848 KB Output is correct
3 Correct 211 ms 9712 KB Output is correct
4 Correct 208 ms 9592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 204 ms 9404 KB Output is correct
7 Correct 107 ms 5164 KB Output is correct
8 Correct 106 ms 5148 KB Output is correct
9 Correct 216 ms 9948 KB Output is correct
10 Correct 139 ms 9824 KB Output is correct
11 Correct 151 ms 9848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 213 ms 9848 KB Output is correct
2 Correct 211 ms 9848 KB Output is correct
3 Correct 211 ms 9712 KB Output is correct
4 Correct 208 ms 9592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 204 ms 9404 KB Output is correct
7 Correct 107 ms 5164 KB Output is correct
8 Correct 106 ms 5148 KB Output is correct
9 Correct 216 ms 9948 KB Output is correct
10 Correct 139 ms 9824 KB Output is correct
11 Correct 151 ms 9848 KB Output is correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 213 ms 9848 KB Output is correct
2 Correct 211 ms 9848 KB Output is correct
3 Correct 211 ms 9712 KB Output is correct
4 Correct 208 ms 9592 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 204 ms 9404 KB Output is correct
7 Correct 107 ms 5164 KB Output is correct
8 Correct 106 ms 5148 KB Output is correct
9 Correct 216 ms 9948 KB Output is correct
10 Correct 139 ms 9824 KB Output is correct
11 Correct 151 ms 9848 KB Output is correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -