답안 #259710

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259710 2020-08-08T11:34:24 Z arnold518 Worst Reporter 2 (JOI16_worst_reporter2) C++14
15 / 100
10 ms 10880 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2e5;

int N;
pii A[MAXN+10], B[MAXN+10];

int dp[(1<<16)+10][20];

int solve(int mask, int p)
{
	if(p==N+1) return 0;

	int &ret=dp[mask][p];
	if(ret!=-1) return ret;

	ret=987654321;
	for(int i=1; i<=N; i++)
	{
		if(mask&(1<<(i-1))) continue;
		if(A[p].first>B[i].first) continue;
		if(A[p].second!=B[i].second) ret=min(ret, solve(mask|(1<<(i-1)), p+1)+1);
		else ret=min(ret, solve(mask|(1<<(i-1)), p+1));
	}
	return ret;
}

int main()
{
	scanf("%d", &N);
	for(int i=1; i<=N; i++) scanf("%d%d", &A[i].second, &A[i].first);
	for(int i=1; i<=N; i++) scanf("%d%d", &B[i].second, &B[i].first);

	memset(dp, -1, sizeof(dp));
	printf("%d\n", solve(0, 1));
}

Compilation message

worst_reporter2.cpp: In function 'int main()':
worst_reporter2.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
worst_reporter2.cpp:36:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=N; i++) scanf("%d%d", &A[i].second, &A[i].first);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
worst_reporter2.cpp:37:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=N; i++) scanf("%d%d", &B[i].second, &B[i].first);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5496 KB Output is correct
2 Correct 4 ms 5504 KB Output is correct
3 Correct 6 ms 5504 KB Output is correct
4 Correct 3 ms 5504 KB Output is correct
5 Correct 4 ms 5504 KB Output is correct
6 Correct 3 ms 5504 KB Output is correct
7 Correct 3 ms 5504 KB Output is correct
8 Correct 3 ms 5504 KB Output is correct
9 Correct 5 ms 5504 KB Output is correct
10 Correct 4 ms 5504 KB Output is correct
11 Correct 8 ms 5504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5496 KB Output is correct
2 Correct 4 ms 5504 KB Output is correct
3 Correct 6 ms 5504 KB Output is correct
4 Correct 3 ms 5504 KB Output is correct
5 Correct 4 ms 5504 KB Output is correct
6 Correct 3 ms 5504 KB Output is correct
7 Correct 3 ms 5504 KB Output is correct
8 Correct 3 ms 5504 KB Output is correct
9 Correct 5 ms 5504 KB Output is correct
10 Correct 4 ms 5504 KB Output is correct
11 Correct 8 ms 5504 KB Output is correct
12 Runtime error 10 ms 10880 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5496 KB Output is correct
2 Correct 4 ms 5504 KB Output is correct
3 Correct 6 ms 5504 KB Output is correct
4 Correct 3 ms 5504 KB Output is correct
5 Correct 4 ms 5504 KB Output is correct
6 Correct 3 ms 5504 KB Output is correct
7 Correct 3 ms 5504 KB Output is correct
8 Correct 3 ms 5504 KB Output is correct
9 Correct 5 ms 5504 KB Output is correct
10 Correct 4 ms 5504 KB Output is correct
11 Correct 8 ms 5504 KB Output is correct
12 Runtime error 10 ms 10880 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5496 KB Output is correct
2 Correct 4 ms 5504 KB Output is correct
3 Correct 6 ms 5504 KB Output is correct
4 Correct 3 ms 5504 KB Output is correct
5 Correct 4 ms 5504 KB Output is correct
6 Correct 3 ms 5504 KB Output is correct
7 Correct 3 ms 5504 KB Output is correct
8 Correct 3 ms 5504 KB Output is correct
9 Correct 5 ms 5504 KB Output is correct
10 Correct 4 ms 5504 KB Output is correct
11 Correct 8 ms 5504 KB Output is correct
12 Runtime error 10 ms 10880 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Halted 0 ms 0 KB -