Submission #417713

# Submission time Handle Problem Language Result Execution time Memory
417713 2021-06-04T07:44:37 Z 송준혁(#7519) Long puzzle (innopolis2021_final_D) C++17
20 / 100
67 ms 1832 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define MOD 1000000007
#define INF (1ll<<62)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

int N, X, Y, L;
pii A[330], B[330];
vector<pii> E;
LL D[330][330][330][2], ans;

int main(){
	char a[10], b[10];
	scanf("%d %d", &N, &L);
	for (int i=1; i<=N; i++){
		int l;
		scanf("%d %s %s", &l, a, b);
		if (a[0] == 'n'){
			if (b[0] == 'n') ans += (l==L);
			else if (b[0] == 'i') D[0][0][l][0]++;
			else D[0][0][l][1]++;
		}
		else if (b[0] == 'n') E.pb(pii(l, a[0] == 'i'));
		else{
			if (a[0] == 'o') A[++X] = pii(l, b[0]=='o');
			else B[++Y] = pii(l, b[0]=='o');
		}
	}
	for (int i=0; i<=X; i++) for (int j=0; j<=Y; j++){
		if (i) for (int k=A[i].fi; k<=L; k++) for (int l=0; l<i; l++) D[i][j][k][A[i].se] = (D[i][j][k][A[i].se] + D[l][j][k-A[i].fi][0])%MOD; 
		if (j) for (int k=B[j].fi; k<=L; k++) for (int l=0; l<j; l++) D[i][j][k][B[j].se] = (D[i][j][k][B[j].se] + D[i][l][k-B[j].fi][1])%MOD; 
	}
	for (pii t : E) for (int i=0; i<=X; i++) for (int j=0; j<=Y; j++) ans = (ans + D[i][j][L-t.fi][t.se])%MOD;
	printf("%lld\n", ans);
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%d %d", &N, &L);
      |  ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |   scanf("%d %s %s", &l, a, b);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Correct 2 ms 844 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Incorrect 1 ms 460 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 588 KB Output is correct
2 Correct 3 ms 588 KB Output is correct
3 Correct 13 ms 960 KB Output is correct
4 Correct 67 ms 1832 KB Output is correct
5 Correct 4 ms 716 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 2 ms 728 KB Output is correct
9 Correct 63 ms 1764 KB Output is correct
10 Correct 67 ms 1748 KB Output is correct
11 Correct 60 ms 1660 KB Output is correct
12 Correct 57 ms 1624 KB Output is correct
13 Correct 8 ms 844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Correct 2 ms 844 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Incorrect 1 ms 460 KB Output isn't correct
8 Halted 0 ms 0 KB -