답안 #1041871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041871 2024-08-02T08:53:44 Z 김은성(#11000) Bring Down the Grading Server (CEOI23_gradingserver) C++17
0 / 100
348 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);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 303 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 321 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 321 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 348 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 321 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 321 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 321 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 321 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -