답안 #125111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
125111 2019-07-04T15:54:56 Z MvC Two Dishes (JOI19_dishes) C++11
10 / 100
1913 ms 80956 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
//#include "rail.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=2e3+50;
const int mod=1e9+7;
using namespace std;
int n,m,i,j;
ll f[nmax][nmax],a[nmax],s[nmax],pa[nmax],pb[nmax],b[nmax],t[nmax],v1[nmax],v2[nmax],ans;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		cin>>a[i]>>s[i]>>v1[i];
		pa[i]=a[i]+pa[i-1];
	}
	for(i=1;i<=m;i++)
	{
		cin>>b[i]>>t[i]>>v2[i];
		pb[i]=b[i]+pb[i-1];
	}
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=m;j++)
		{
			if(i)f[i][j]=max(f[i][j],f[i-1][j]+(pa[i]+pb[j]<=s[i]));
			if(j)f[i][j]=max(f[i][j],f[i][j-1]+(pa[i]+pb[j]<=t[j]));
			ans=max(ans,f[i][j]);
		}
	}
	cout<<ans<<endl;
    return 0;
}

Compilation message

dishes.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
dishes.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1913 ms 80956 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 57 ms 32684 KB Output is correct
18 Correct 57 ms 32632 KB Output is correct
19 Correct 57 ms 32732 KB Output is correct
20 Correct 55 ms 32632 KB Output is correct
21 Correct 57 ms 31392 KB Output is correct
22 Correct 57 ms 32552 KB Output is correct
23 Correct 56 ms 32632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 57 ms 32684 KB Output is correct
18 Correct 57 ms 32632 KB Output is correct
19 Correct 57 ms 32732 KB Output is correct
20 Correct 55 ms 32632 KB Output is correct
21 Correct 57 ms 31392 KB Output is correct
22 Correct 57 ms 32552 KB Output is correct
23 Correct 56 ms 32632 KB Output is correct
24 Runtime error 1864 ms 77876 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 57 ms 32684 KB Output is correct
18 Correct 57 ms 32632 KB Output is correct
19 Correct 57 ms 32732 KB Output is correct
20 Correct 55 ms 32632 KB Output is correct
21 Correct 57 ms 31392 KB Output is correct
22 Correct 57 ms 32552 KB Output is correct
23 Correct 56 ms 32632 KB Output is correct
24 Runtime error 1864 ms 77876 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 57 ms 32684 KB Output is correct
18 Correct 57 ms 32632 KB Output is correct
19 Correct 57 ms 32732 KB Output is correct
20 Correct 55 ms 32632 KB Output is correct
21 Correct 57 ms 31392 KB Output is correct
22 Correct 57 ms 32552 KB Output is correct
23 Correct 56 ms 32632 KB Output is correct
24 Runtime error 1864 ms 77876 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1913 ms 80956 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1913 ms 80956 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -