제출 #1298239

#제출 시각아이디문제언어결과실행 시간메모리
1298239hssaan_arifUnscrambling a Messy Bug (IOI16_messy)C++20
컴파일 에러
0 ms0 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; #define endl "\n" #define pb push_back // #define int long long #define fi first #define se second const int N = 3e5 + 5, M = 1e9 + 7, LG = 20; int n , A[N] , w , r; vector<int> restore_permutation(int n, int w, int r) { string s = ""; for (int i=0 ; i<n ; i++) s += '0'; for (int i=0 ; i<n-1 ; i++){ s[i] = '1'; add_element(s); } compile_set(); int su = 0; vector<int> P(n) map<int,int> in; for (int i=0 ; i<n-1 ; i++){ string t = ""; for (int j=0 ; j<n ; j++){ if (in[j]){ t += '1'; }else{ t += '0'; } } for (int j=0 ; j<n ; j++){ if (t[j] == '0'){ t[j] = '1'; bool x = check_element(t); if (x){ in[j] = 1; P[i] = j; su += j; break; } t[j] = '0'; } } } P[n-1] = (n*(n-1))/2 - su; // check_element("0"); return P; } // signed main(){ // cin >> n >> w >> r; // restore_permutation(n,w,r); // }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:25:5: error: expected ',' or ';' before 'map'
   25 |     map<int,int> in;
      |     ^~~
messy.cpp:29:17: error: 'in' was not declared in this scope; did you mean 'i'?
   29 |             if (in[j]){
      |                 ^~
      |                 i
messy.cpp:40:21: error: 'in' was not declared in this scope; did you mean 'i'?
   40 |                     in[j] = 1;
      |                     ^~
      |                     i
messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~