# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
950754 | 2024-03-20T16:10:15 Z | Vladth11 | CEOI16_icc (CEOI16_icc) | C++14 | 88 ms | 636 KB |
#include <bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " #pragma GCC optimize ("Ofast") #pragma GCC target ("avx2") #include "icc.h" using namespace std; typedef long long ll; typedef pair <int, int> pii; const ll NMAX = 101; const ll INF = (1LL << 58); const ll nrbits = 20; const ll MOD = 998244353; const int VMAX = 10; int a[NMAX]; int b[NMAX]; set <int> st[NMAX]; int pa[NMAX]; int n; int dsu(int x){ if(pa[x] == x) return x; return pa[x] = dsu(pa[x]); } void merge(int a, int b){ a = dsu(a); b = dsu(b); pa[b] = a; for(auto x : st[b]) st[a].insert(x); st[b].clear(); } int sol1, sol2; int auxiliar[NMAX]; int nrAux, nrA, nrB; int divideA(int st, int dr){ if(st == dr) return a[st]; int mid = (st + dr) / 2; nrAux = 0; for(int i = st; i <= mid; i++){ auxiliar[nrAux++] = a[i]; } int rez = query(nrAux, nrB, auxiliar, b); if(rez) return divideA(st, mid); return divideA(mid + 1, dr); } int divideB(int st, int dr){ if(st == dr) return b[st]; int mid = (st + dr) / 2; nrAux = 0; for(int i = st; i <= mid; i++){ auxiliar[nrAux++] = b[i]; } int rez = query(nrA, nrAux, a, auxiliar); if(rez) return divideB(st, mid); return divideB(mid + 1, dr); } void newEdge(){ vector <int> cn; sol1 = sol2 = -1; for(int i = 1; i <= n; i++){ int rt = dsu(i); if(rt != i) continue; cn.push_back(i); } for(int j = 0; j < 7; j++){ nrA = 0; nrB = 0; for(int i = 0; i < cn.size(); i++){ int x = cn[i]; if(i & (1 << j)){ for(auto y : st[x]){ a[nrA++] = y; } }else{ for(auto y : st[x]){ b[nrB++] = y; } } } int rez = query(nrA, nrB, a, b); if(rez){ break; } } int primul = divideA(0, nrA - 1); int doilea = divideB(0, nrB - 1); setRoad(primul, doilea); merge(primul, doilea); } void run(int N){ n = N; int i; for(i = 1; i <= n; i++){ pa[i] = i; st[i].insert(i); } for(i = 1; i < n; i++){ newEdge(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 600 KB | Ok! 98 queries used. |
2 | Correct | 7 ms | 604 KB | Ok! 100 queries used. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 600 KB | Ok! 523 queries used. |
2 | Correct | 35 ms | 604 KB | Ok! 659 queries used. |
3 | Correct | 26 ms | 604 KB | Ok! 658 queries used. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 636 KB | Ok! 1406 queries used. |
2 | Correct | 82 ms | 604 KB | Ok! 1612 queries used. |
3 | Correct | 77 ms | 604 KB | Ok! 1577 queries used. |
4 | Correct | 86 ms | 624 KB | Ok! 1484 queries used. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 77 ms | 604 KB | Ok! 1500 queries used. |
2 | Correct | 79 ms | 636 KB | Ok! 1485 queries used. |
3 | Correct | 79 ms | 600 KB | Ok! 1636 queries used. |
4 | Correct | 76 ms | 600 KB | Ok! 1456 queries used. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 82 ms | 604 KB | Ok! 1623 queries used. |
2 | Correct | 80 ms | 628 KB | Ok! 1608 queries used. |
3 | Correct | 88 ms | 600 KB | Ok! 1668 queries used. |
4 | Correct | 84 ms | 620 KB | Ok! 1636 queries used. |
5 | Correct | 77 ms | 604 KB | Ok! 1423 queries used. |
6 | Correct | 80 ms | 604 KB | Ok! 1530 queries used. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 81 ms | 600 KB | Too many queries! 1644 out of 1625 |
2 | Halted | 0 ms | 0 KB | - |