Submission #212342

# Submission time Handle Problem Language Result Execution time Memory
212342 2020-03-22T17:41:45 Z DEDA Chameleon's Love (JOI20_chameleon) C++14
40 / 100
23 ms 512 KB
/*
 _____ ____ _____   ___   ___   ___   ___ 
|_   _/ __ \_   _| |__ \ / _ \ |__ \ / _ \
  | || |  | || |      ) | | | |   ) | | | |
  | || |  | || |     / /| | | |  / /| | | |
 _| || |__| || |_   / /_| |_| | / /_| |_| |
|_____\____/_____| |____|\___/ |____|\___/ 
*/
#include <bits/stdc++.h>
#include <fstream>
#include "chameleon.h"
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
// pair<int,int>ert(x==y); gives run time when false
using namespace std;
// Query Answer
void Solve(int N)
{
    int n = 2 * N;
    vii v(n + 1, vi(2));
    vector<set<int>> v1(n + 1);
    rep(i, 1, n + 1)
    {
        vi jm;
        rep(j, 1, n + 1)
        {
            if (i == j)
                continue;
            vi temp = {i, j};
            int g = Query(temp);
            if (g == 1)
            {
                jm.pb(j);
            }
        }
        // rep(j, 0, 3)
        // {
        //     v[i][j] = jm[j];
        //     v1[i].insert(jm[j]);
        // }
        if (jm.size() == 3)
        {
            if (Query({i, jm[0], jm[1]}) == 1)
            {
                v[i][0] = jm[0];
                v[i][1] = jm[1];
                v1[i].insert(jm[0]);
                v1[i].insert(jm[1]);
                continue;
            }
            if (Query({i, jm[0], jm[2]}) == 1)
            {
                v[i][0] = jm[0];
                v[i][1] = jm[2];
                v1[i].insert(jm[0]);
                v1[i].insert(jm[2]);
                continue;
            }
            if (Query({i, jm[2], jm[1]}) == 1)
            {
                v[i][0] = jm[2];
                v[i][1] = jm[1];
                v1[i].insert(jm[2]);
                v1[i].insert(jm[1]);
                continue;
            }
        }else{
            v[i][0] = jm[0];
            v1[i].insert(jm[0]);
        }
    }
    vi vis(n + 1, 0);
    rep(i, 1, n + 1)
    {
        if (vis[i])
            continue;
        rep(j, 0, 2)
        {
            if (v1[v[i][j]].count(i))
            {
                vis[i] = 1;
                vis[v[i][j]] = 1;
                Answer(i, v[i][j]);
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 21 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 6 ms 384 KB Output is correct
13 Correct 7 ms 384 KB Output is correct
14 Correct 7 ms 384 KB Output is correct
15 Correct 6 ms 384 KB Output is correct
16 Correct 7 ms 384 KB Output is correct
17 Correct 8 ms 384 KB Output is correct
18 Correct 6 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 Incorrect 23 ms 512 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 4 ms 384 KB Output is correct
3 Incorrect 21 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -