Submission #1040521

# Submission time Handle Problem Language Result Execution time Memory
1040521 2024-08-01T06:50:43 Z hotboy2703 Chameleon's Love (JOI20_chameleon) C++17
40 / 100
2 ms 600 KB
#include "chameleon.h"

#include<bits/stdc++.h>
using ll = int;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mQuery,i) (((mQuery) >> (i))&1)
#define MQuery(i) (1LL << (i))
namespace {

int variable_example = 1;

}  // namespace
namespace MOMJOKES{
    const ll MAXN = 510;
    ll L[MAXN],R[MAXN];
    vector <ll> cand[MAXN];
}
void Solve(int n) {
    using namespace MOMJOKES;
    for (ll i = 1;i <= 2*n;i ++){
        for (ll j = i + 1;j <= 2*n;j ++){
            if (Query({i,j}) == 1){
                cand[i].push_back(j);
                cand[j].push_back(i);
            }
        }
    }
    set <pll> s;
    for (ll i = 1;i <= 2 * n;i ++){
        if (sz(cand[i]) == 3){
            for (ll j = 0;j < 3;j ++){
                vector <ll> all = {i};
                for (ll j1 = 0;j1 < 3;j1 ++){
                    if (j1 != j)all.push_back(cand[i][j1]);
                }
                if (Query(all) == 1){
                    L[i] = cand[i][j];
                    break; 
                }
            }
        }
        else{
            ll u = i,v = cand[i][0];
            if (u > v)swap(u,v);
            s.insert(MP(u,v));
        }
    }    
    for (ll i = 1;i <= 2 * n;i ++){
        if (sz(cand[i]) == 3){
            for (ll j = 0;j < 3;j ++){
                if (cand[i][j] == L[i] || L[cand[i][j]] == i)continue;
                ll u = i,v = cand[i][j];
                if (u > v)swap(u,v);
                s.insert(MP(u,v));
            }
        }
    }   
    for (auto x:s)Answer(x.fi,x.se);
}

Compilation message

chameleon.cpp:15:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   15 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Runtime error 2 ms 600 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 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 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 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 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Runtime error 1 ms 600 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Runtime error 2 ms 600 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -