답안 #536892

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536892 2022-03-14T06:53:29 Z Hydroxic_Acid Speedrun (RMI21_speedrun) C++17
컴파일 오류
0 ms 0 KB
#include "speedrun.h"

void assignHints(int subtask, int N, int A[], int B[]) {
    setHintLen(20);
    cen = 0;
    if(A[0] == A[1] || A[0] == B[1]) cen = A[0];
    else cen = B[0];
    for(int i = 0; i < N; i++){
		int j = 1;
		int temp = cen;
		while(temp&-temp != 0){
			if(temp&-temp == 1){
				setHint(i, j, true);
				temp--;
			}
			temp >> 1; j++;
		}
	}
    
}

void speedrun(int subtask, int N, int start) {
	int cen = 0;
	for(int i = 1; i <= 10; i++){
		if(getHint(start, i)) cen++;
		cen << 1;
	}
	int left = N - 1;
	while(left > 0){
		if(start == cen){
			while(!goTo(N))N--;
			N--;
		}
		else{
			visited--;
			goTo(cen);
		}
	}
}

Compilation message

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:5:5: error: 'cen' was not declared in this scope
    5 |     cen = 0;
      |     ^~~
speedrun.cpp:11:20: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   11 |   while(temp&-temp != 0){
      |              ~~~~~~^~~~
speedrun.cpp:12:18: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   12 |    if(temp&-temp == 1){
      |            ~~~~~~^~~~
speedrun.cpp:16:9: warning: statement has no effect [-Wunused-value]
   16 |    temp >> 1; j++;
      |    ~~~~~^~~~
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:25:22: error: too many arguments to function 'bool getHint(int)'
   25 |   if(getHint(start, i)) cen++;
      |                      ^
In file included from speedrun.cpp:1:
speedrun.h:11:6: note: declared here
   11 | bool getHint(int j);
      |      ^~~~~~~
speedrun.cpp:26:7: warning: statement has no effect [-Wunused-value]
   26 |   cen << 1;
      |   ~~~~^~~~
speedrun.cpp:35:4: error: 'visited' was not declared in this scope
   35 |    visited--;
      |    ^~~~~~~