제출 #957122

#제출 시각아이디문제언어결과실행 시간메모리
957122DeltaStructHandcrafted Gift (IOI20_gift)C++17
컴파일 에러
0 ms0 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; int construct(int n,int m,int[] A,int[] B,int[] C){ vector<int> D(n); iota(D.begin(),D.end(),0); for (int i(0);i < m;++i) if (C[i]==1) D[A[i]] = max(D[A[i]],B[i]); set<int> s; string r,u="RB"; int t=0; for (int i(0);i < n;++i){ s.emplace(D[i]),r+=u[t]; if (s.find(i)!=s.end()) s.erase(i); if (s.empty()) t^=1; } vector<int> acc(1); int cant = 0; for (char a:r) acc.emplace_back(acc.back()+(a=='B')); for (int i(0);i < m;++i) if (C[i]==2) if (acc[B[i]+1]-acc[A[i]]==0||acc[B[i]+1]-acc[A[i]]==B[i]-A[i]+1) cant = 1; if (cant) return 0; craft(r); return 1; }

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

gift.cpp:5:33: error: expected ',' or '...' before 'A'
    5 | int construct(int n,int m,int[] A,int[] B,int[] C){
      |                                 ^
gift.cpp: In function 'int construct(int, int, int*)':
gift.cpp:7:32: error: 'C' was not declared in this scope
    7 |   for (int i(0);i < m;++i) if (C[i]==1) D[A[i]] = max(D[A[i]],B[i]);
      |                                ^
gift.cpp:7:43: error: 'A' was not declared in this scope
    7 |   for (int i(0);i < m;++i) if (C[i]==1) D[A[i]] = max(D[A[i]],B[i]);
      |                                           ^
gift.cpp:7:63: error: 'B' was not declared in this scope
    7 |   for (int i(0);i < m;++i) if (C[i]==1) D[A[i]] = max(D[A[i]],B[i]);
      |                                                               ^
gift.cpp:15:32: error: 'C' was not declared in this scope
   15 |   for (int i(0);i < m;++i) if (C[i]==2) if (acc[B[i]+1]-acc[A[i]]==0||acc[B[i]+1]-acc[A[i]]==B[i]-A[i]+1) cant = 1;
      |                                ^
gift.cpp:15:49: error: 'B' was not declared in this scope
   15 |   for (int i(0);i < m;++i) if (C[i]==2) if (acc[B[i]+1]-acc[A[i]]==0||acc[B[i]+1]-acc[A[i]]==B[i]-A[i]+1) cant = 1;
      |                                                 ^
gift.cpp:15:61: error: 'A' was not declared in this scope
   15 |   for (int i(0);i < m;++i) if (C[i]==2) if (acc[B[i]+1]-acc[A[i]]==0||acc[B[i]+1]-acc[A[i]]==B[i]-A[i]+1) cant = 1;
      |                                                             ^