제출 #829839

#제출 시각아이디문제언어결과실행 시간메모리
829839MODDI최후의 만찬 (IOI12_supper)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "advisor.h" using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int,int> pii; typedef pair<ll, ll> pll; int n; vi G[100005]; priority_queue<pii> activasion; set<int> in_pq; vi advice, out; void ComputeAdvice(int *C, int N, int K, int M) { n = N; for(int i = n-1; i >= 0; i--) G[C[i]].pb(i); for(int i = 0; i < K; i++){ int when = n - 1; if(!G[i].empty()) when = G[i].back(); activasion.push(mp(-when, i)); in_pq.insert(i); } advice.resize(n+K, 1); out.resize(K); iota(out.begin(), out.end(), 1); for(int i = 0; i < n; i++){ G[C[i]].pop_back(); out[C[i]] = K + i; if(in_pq.find(C[i]) != in_pq.end()){ pii sega = activasion.top(); activasion.pop(); in_pq.erase(sega.second); advice[out[sega.second]] = 0; } int when = 0; in_pq.insert(C[i]); if(G[C[i]].empty())when = n+1; else when = G[C[i]].back(); activasion.push(mp(-when+i%2, C[i])); } for(int i = 0; i < n; i++) WriteAdvice(advice[i]); }
#include "assistant.h" #include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int,int> pii typedef pair<ll, ll> pll; void Assist(unsigned char *A, int N, int K, int R) { set<int> odma, in; for(int i = 0; i < K; i++){ if(A[i] == 0) odma.insert(i); in.insert(i); } for(int i = 0; i < n; i++){ int adv = GetRequest(); if(odma.find(adv) == odma.end()){ PutBack(*odma.begin()); in.erase(*odma.begin()); odma.erase(*odma.begin()); } in.insert(adv); if(A[i+k] == 0) odma.insert(adv); } }

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

assistant.cpp:10:1: error: expected initializer before 'typedef'
   10 | typedef pair<ll, ll> pll;
      | ^~~~~~~
assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:18:21: error: 'n' was not declared in this scope
   18 |  for(int i = 0; i < n; i++){
      |                     ^
assistant.cpp:26:10: error: 'k' was not declared in this scope
   26 |   if(A[i+k] == 0) odma.insert(adv);
      |          ^