제출 #1151851

#제출 시각아이디문제언어결과실행 시간메모리
1151851arkanefuryMouse (info1cup19_mouse)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.h" #define pb push_back using namespace std; #define F first #define sz size() #define S second #define in insert #define all(v) v.begin(), v.end() #define FOR(x, n, m, d) for(int x = n; x <= m; x += d) #define FORR(x, n) for(int i = x; i >= n; i --) #define nikita ios_base::sync_with_stdio(0), cin.tie(0); const int N = 256+5; int n,m,k,tt,ans,sum=0,l, r, x, y, cnt, block = 448; int a[N][N], b[N]; void solve(int n){ vector<int>q, v; FOR(i, 1, n, 1){ q.pb(i); } ans = query(q); if(ans==n)return; FOR(i, 1, n-1, 1){ bool ji = 0; if(b[i])continue; FOR(j, i, n-1, 1){ if( b[j+1] )continue; swap(q[i-1], q[j]); sum = query(q); if(sum==n)return; v = q; if(sum == ans + 1){ if(ji){ans ++;break;} bool f = 0; FOR(ok, i, n-1, 1){ if(b[ok+1])continue; swap(q[i-1], q[ok]); k = query(q); if(k==n)return; swap(q[i-1], q[ok]); if(k > sum)f = 1; } if(!f){ q = v; ans++; break; } ji = q; else b[j+1] = 1; } if(sum==ans+2){ ans += 2; b[i] = b[j+1] = 1; break; } if(sum != ans + 1) swap(q[i-1], q[j]); } } query(q); } /* signed main() { nikita tt = 1; if(!tt)cin >> tt; FOR(i, 1, tt, 1){ solve(); } } */

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

mouse.cpp: In function 'void solve(int)':
mouse.cpp:48:22: error: cannot convert 'std::vector<int>' to 'bool' in assignment
   48 |                 ji = q;
      |                      ^
      |                      |
      |                      std::vector<int>
mouse.cpp:49:17: error: expected '}' before 'else'
   49 |                 else b[j+1] = 1;
      |                 ^~~~
mouse.cpp:32:31: note: to match this '{'
   32 |             if(sum == ans + 1){
      |                               ^
mouse.cpp:53:26: error: 'j' was not declared in this scope; did you mean 'ji'?
   53 |                 b[i] = b[j+1] = 1;
      |                          ^
      |                          ji
mouse.cpp:56:47: error: 'j' was not declared in this scope; did you mean 'ji'?
   56 |             if(sum != ans + 1) swap(q[i-1], q[j]);
      |                                               ^
      |                                               ji
mouse.cpp: At global scope:
mouse.cpp:59:10: error: expected constructor, destructor, or type conversion before '(' token
   59 |     query(q);
      |          ^
mouse.cpp:60:1: error: expected declaration before '}' token
   60 | }
      | ^