답안 #536894

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536894 2022-03-14T06:56:23 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);
    intcen = 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){
			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(i)) cen++;
		cen << 1;
	}
	int left = N - 1;
	while(left > 0){
		if(start == cen){
			while(!goTo(N))N--;
			N--;
		}
		else{
			left--;
			goTo(cen);
		}
	}
}

Compilation message

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:5:5: error: 'intcen' was not declared in this scope
    5 |     intcen = 0;
      |     ^~~~~~
speedrun.cpp:6:38: error: 'cen' was not declared in this scope
    6 |     if(A[0] == A[1] || A[0] == B[1]) cen = A[0];
      |                                      ^~~
speedrun.cpp:7:10: error: 'cen' was not declared in this scope
    7 |     else cen = B[0];
      |          ^~~
speedrun.cpp:10:14: error: 'cen' was not declared in this scope
   10 |   int temp = cen;
      |              ^~~
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:26:7: warning: statement has no effect [-Wunused-value]
   26 |   cen << 1;
      |   ~~~~^~~~