Submission #1041877

# Submission time Handle Problem Language Result Execution time Memory
1041877 2024-08-02T09:00:48 Z 김은성(#11000) Bring Down the Grading Server (CEOI23_gradingserver) C++17
0 / 100
286 ms 1048576 KB
#include <bits/stdc++.h>
using namespace std;
int s,q;
unordered_map<short, bool> dp[309][309][309];
bool win(int ch, int fh, int cg, int fg){
	if(dp[ch][fh][cg].find(fg) != dp[ch][fh][cg].end())
		return dp[ch][fh][cg][fg];
	if(ch == 0)
		dp[ch][fh][cg][fg] = 0;
	else if(cg == 0)
		dp[ch][fh][cg][fg] = 1;
	else{
		dp[ch][fh][cg][fg] = 0;
		if(fg > 0 && !win(cg, max(fg-1, 0), ch, fh))
			dp[ch][fh][cg][fg] = 1;
		if(ch-fg*s > 0 && !win(max(cg-max(ch-fg*s, 0), 0), fg,ch,fh))
			dp[ch][fh][cg][fg] = 1;
	}
	return dp[ch][fh][cg][fg];
}
int main(){
	int ch, fh, cg, fg, i;
	scanf("%d %d", &s, &q);
	while(q--){
		scanf("%d %d %d %d", &ch, &fh, &cg, &fg);
		printf("%s\n", win(ch, fh, cg, fg) ? "YES" : "NO");
	}
	return 0;
}

Compilation message

gradingserver.cpp: In function 'int main()':
gradingserver.cpp:22:22: warning: unused variable 'i' [-Wunused-variable]
   22 |  int ch, fh, cg, fg, i;
      |                      ^
gradingserver.cpp:23:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  scanf("%d %d", &s, &q);
      |  ~~~~~^~~~~~~~~~~~~~~~~
gradingserver.cpp:25:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   scanf("%d %d %d %d", &ch, &fh, &cg, &fg);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 286 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 280 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 280 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 274 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 280 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 280 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 280 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 280 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -