제출 #485280

#제출 시각아이디문제언어결과실행 시간메모리
485280malarHandcrafted Gift (IOI20_gift)C++14
15 / 100
1598 ms22732 KiB
#include <bits/stdc++.h> #include "gift.h" using namespace std; #include <algorithm> #include <vector> #include <cassert> #include <cstdio> #include <string> vector<int>parent; int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) { parent.resize(n); for(int l=0;l<n;l++) parent[l]=l; for(int i = 0; i < r; i++){ if(x[i] == 2) continue; for (int e = a[i] + 1; e < b[i] + 1; e++) parent[e] = parent[a[i]]; } for(int i=0; i < r; i++) { if(x[i] == 1) continue; if(a[i] == b[i]) return 0; if (parent[b[i]] - parent[a[i]] < 1) return 0; } string s ="R"; for(int i=1;i<n;i++) { if(parent[i] != parent[i-1]) if(s.back() == 'R')s += "B"; else s+= "R"; else s+= s.back(); } craft(s); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...