Submission #212176

# Submission time Handle Problem Language Result Execution time Memory
212176 2020-03-22T12:08:43 Z M0REDA Chameleon's Love (JOI20_chameleon) C++14
40 / 100
593 ms 1272 KB
#include <bits/stdc++.h>
#include "chameleon.h"
#define debug(x) cerr << #x << " = " << x << ", ";
#define ll long long
#define pb push_back
using namespace std;
#define FAST_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
void Solve(int N)
{
    vector<vector<int>> v(2 * N + 1);
    vector<int> graph(2 * N + 1, -1);
    for (int i = 1; i <= 2 * N; i++)
    {
        for (int j = i + 1; j <= 2 * N && v[i].size() < 3; j++)
        {
            vector<int> p;
            p.pb(i);
            p.pb(j);
            int z = Query(p);
            debug(i);
            debug(j);
            debug(z);
            cerr << endl;
            cerr << "======================" << endl;
            if (z == 1)
            {
                v[i].pb(j);
                v[j].pb(i);
            }
        }
    }
    for (auto a : v)
    {
        for (auto b : a)
        {
            cerr << b << " ";
        }
        cerr << endl;
    }
    for (int i = 1; i <= 2 * N; i++)
    {
        if (v[i].size() == 1)
        {
            continue;
        }
        for (int j = 0; j < 3 && graph[i] == -1; j++)
        {
            for (int k = j + 1; k < 3; k++)
            {
                vector<int> p;
                p.pb(i);
                p.pb(v[i][j]);
                p.pb(v[i][k]);
                if (Query(p) == 1)
                {
                    graph[i] = v[i][3 - j - k];
                    break;
                }
            }
        }
    }
    for (int i = 1; i <= 2 * N; i++)
    {
        debug(i);
        cerr << endl;
        cerr << " tttttttttt " << endl;
        if (v[i].size() == 1)
        {
            debug(i);

            debug(v[i][0]);
            cerr << endl;
            cerr << "===================" << endl;
            if (i < v[i][0])
                Answer(i, v[i][0]);
            continue;
        }
        if (v[i].size() == 2)
        {
            assert(false);
        }
        for (int j = 0; j < 3; j++)
        {
            debug(i);
            debug(v[i][j]);
            cerr << endl;
            if (v[i][j] == graph[i] || i == graph[v[i][j]])
            {
                continue;
            }
            cerr << "passed" << endl;
            cerr << "===================" << endl;

            if (i < v[i][j])
                Answer(i, v[i][j]);
            break;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 591 ms 1272 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 8 ms 392 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 8 ms 392 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 8 ms 384 KB Output is correct
10 Correct 97 ms 504 KB Output is correct
11 Correct 149 ms 504 KB Output is correct
12 Correct 91 ms 504 KB Output is correct
13 Correct 102 ms 480 KB Output is correct
14 Correct 98 ms 504 KB Output is correct
15 Correct 164 ms 608 KB Output is correct
16 Correct 104 ms 504 KB Output is correct
17 Correct 96 ms 504 KB Output is correct
18 Correct 98 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 512 KB Output is correct
3 Incorrect 593 ms 1272 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 591 ms 1272 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -