답안 #1021648

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1021648 2024-07-13T01:15:07 Z 12345678 카멜레온의 사랑 (JOI20_chameleon) C++17
0 / 100
15 ms 600 KB
#include "chameleon.h"
#include <bits/stdc++.h>
 
using namespace std;
 
const int nx=1e3+5;
 
int vs[nx], v[nx][nx];
vector<int> d[nx];
 
void Solve(int N) {
    for (int i=1; i<=2*N; i++) for (int j=1; j<i; j++) if (Query(vector<int> {i, j})==1) d[i].push_back(j), d[j].push_back(i);
    for (int i=1; i<=2*N; i++)
    {
        if (vs[i]) continue;
        if (d[i].size()==1)
        {
            Answer(i, d[i][0]);
            vs[i]=vs[d[i][0]]=1;
            continue;
        }
        bool f=0;
        for (int j=0; j<2; j++)
        {
            vector<int> qrs;
            qrs.push_back(i);
            for (int k=0; k<3; k++) if (k!=j) qrs.push_back(d[i][k]);
            if (Query(qrs)==1)
            {
                f=1;
                v[i][d[i][j]]=v[d[i][j]][i]=1;
                break;
            }
        }
        if (!f) v[i][d[i][2]]=v[d[i][2]][i]=1;
    }
    for (int i=1; i<=2*N; i++)
    {
        if (vs[i]) continue;
        int cnt=0;
        for (int j=0; j<3; j++) if (!v[i][d[i][j]]) cnt++;
        if (cnt>1) cout<<1/0;
        for (int j=0; j<3; j++) if (!vs[i]&&!vs[d[i][j]]&&!v[i][d[i][j]]) vs[i]=vs[d[i][j]]=1, Answer(i, d[i][j]);
    }
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:42:27: warning: division by zero [-Wdiv-by-zero]
   42 |         if (cnt>1) cout<<1/0;
      |                          ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 480 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 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Runtime error 1 ms 600 KB Execution killed with signal 4
9 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 Correct 0 ms 352 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Runtime error 1 ms 600 KB Execution killed with signal 4
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 15 ms 480 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 15 ms 480 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -