제출 #400395

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
4003952021-05-07 22:59:54nikatamlianiBitaro’s Party (JOI18_bitaro)C++14
100 / 100
1398 ms95172 KiB
#include <bits/stdc++.h>
using namespace std;
void maxi(int &x, int y) {
if(x < y) x = y;
}
const int C = 100;
bool vis[100005];
void merge(vector<pair<int, int>> &a, const vector<pair<int, int>> &b) {
vector<pair<int, int>> c;
int n = (int)a.size(), m = (int)b.size();
for(int i = 0, j = 0; i < n || j < m;) {
if((int)c.size() == C) break;
if(i < n && vis[a[i].second]) { ++i; continue; }
if(j < m && vis[b[j].second]) { ++j; continue; }
if(j == m || (i < n && a[i].first > b[j].first+1)) {
c.push_back(a[i]);
vis[a[i++].second] = 1;
} else {
c.push_back({b[j].first+1, b[j].second});
vis[b[j++].second] = 1;
}
}
for(const auto &p : c) vis[p.second] = 0;
a = c;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, m, q;
cin >> n >> m >> q;
vector<vector<int>> g(n+1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...