제출 #756325

#제출 시각아이디문제언어결과실행 시간메모리
7563251binHandcrafted Gift (IOI20_gift)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 5e5 + 5; int par[NMAX], nx[NMAX]; vector<tuple<int, int, int>> v; int find(int x){return par[x] == -1 ? x : par[x] = find(par[x]);} int construct(int n, int r, vector<int> a, vector<int> b, vector<int> x){ string s(n, 'B'); for(int i = 0; i < r; i++) v.emplace_back(x[i], a[i], b[i]); sort(all(v)); memset(par, -1, sizeof(par)); for(int i = 0; i < n; i++) nx[i] = i + 1; for(auto&[x, a, b] : v){ if(x == 1){ a = find(a); for(int i = nx[a]; i <= b; i = nx[a]){ int p = find(i); nx[a] = nx[p]; par[p] = a; } } else if(find(a) == find(b)) return 0; } int f = 0; for(int i = 0; i < n; i++){ if(find(i) == i) f ^= 1; if(f == 1) s[i] = 'R'; } craft(s); //cout << s << '\n'; return 1; } /* int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, r; cin >> n >> r; vector<int> a(n), b(n), x(n); for(int i = 0; i < r; i++) cin >> a[i] >> b[i] >> x[i]; construct(n, r, a, b, x); return 0; } */ /* 4 2 0 2 1 2 3 2 3 3 0 1 1 1 2 1 0 2 2 */

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

gift.cpp: In function 'int construct(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
gift.cpp:19:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   19 |     for(auto&[x, a, b] : v){
      |              ^
gift.cpp:36:5: error: 'craft' was not declared in this scope
   36 |     craft(s);
      |     ^~~~~