답안 #919354

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
919354 2024-01-31T16:04:26 Z winter0101 카멜레온의 사랑 (JOI20_chameleon) C++14
40 / 100
58 ms 1000 KB
#include<bits/stdc++.h>
#include "chameleon.h"
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
const int maxn=1e3+9;
vector<int>a[maxn];
bool edg[maxn][maxn];
bool use[maxn];
void Solve(int n){
    if (n<=50){
    for1(i,1,2*n){
    for1(j,1,2*n){
    if (i==j)continue;
    if (Query({i,j})==1){
    a[i].pb(j);
    }
    }
    }
    }
    else {
    for1(i,1,n){
    for1(j,n+1,2*n){
    use[j]=0;
    }
    while (true){
    int l=n+1,r=2*n,ans=-1;
    while (l<=r){
    int mid=(l+r)/2;
    vector<int>check;
    check.pb(i);
    for1(j,n+1,mid){
    if (use[j])continue;
    check.pb(j);
    }
    if (Query(check)<sz(check)){
    ans=mid;
    r=mid-1;
    }
    else l=mid+1;
    }
    if (ans==-1)break;
    use[ans]=1;
    a[i].pb(ans);
    a[ans].pb(i);
    }
    }
    }
    vector<pii>ans;
    for1(i,1,2*n){
    if (sz(a[i])==1){
    for (auto v:a[i]){
    edg[v][i]=edg[i][v]=1;
    }
    }
    else {
    vector<int>check;
    check.pb(i);
    for1(j,0,sz(a[i])-1){
    check.pb(a[i][j]);
    for1(k,j+1,sz(a[i])-1){
    check.pb(a[i][k]);
    if (Query(check)==1){
    edg[i][a[i][j]]=1;
    edg[i][a[i][k]]=1;
    }
    check.pop_back();
    }
    check.pop_back();
    }
    }
    }
    for1(i,1,2*n){
    for1(j,i+1,2*n){
    if (edg[i][j]&&edg[j][i]){
    Answer(i,j);
    }
    }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 58 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 3 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 2 ms 512 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 53 ms 1000 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 58 ms 344 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -