제출 #654952

#제출 시각아이디문제언어결과실행 시간메모리
654952sandry24동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define pb push_back #define mp make_pair #define f first #define s second void exploreCave(int N){ int s[N], d[N]; vector<bool> checked(N); for(int i = 0; i < N; i++){ int l = 0, r = N-1; int f_ans = tryCombination(s); while(l != r){ vi temp = s; int mid = (l+r)/2; for(int j = l; j <= mid; j++){ if(checked[j]) continue; temp[j] = !s[j]; } int ans = tryCombination(temp); if(ans != f_ans) r = mid; else l = mid+1; } d[i] = l; checked[l] = 1; if(f_ans == i) s[l] == !s[l]; } answer(s, d); }

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:11:11: error: conversion from 'int [N]' to non-scalar type 'vi' {aka 'std::vector<int>'} requested
   11 | #define s second
      |           ^~~~~~
cave.cpp:20:23: note: in expansion of macro 's'
   20 |             vi temp = s;
      |                       ^
cave.cpp:27:38: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   27 |             int ans = tryCombination(temp);
      |                                      ^~~~
      |                                      |
      |                                      vi {aka std::vector<int>}
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:36:18: warning: statement has no effect [-Wunused-value]
   36 |             s[l] == !s[l];
      |                  ^