QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#357126#403. Memory2ewrilan100 ✓1ms4048kbC++144.0kb2024-03-18 18:36:242024-03-18 18:36:25

Judging History

你现在查看的是最新测评结果

  • [2024-03-18 18:36:25]
  • 评测
  • 测评结果:100
  • 用时:1ms
  • 内存:4048kb
  • [2024-03-18 18:36:24]
  • 提交

answer

//
#ifndef __SIZEOF_INT128__
  #define __SIZEOF_INT128__
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template <typename T> using oset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define rep(i, p, k) for(int i(p); i < (k); ++i)
#define per(i, p, k) for(int i(p); i > (k); --i)
#define sz(x) (int)(x).size()
#define sc static_cast
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef __int128_t lll;
//#define int ll
template <typename T = int> using par = std::pair <T, T>;
#define fi first
#define se second
#define test int _number_of_tests(in()); while(_number_of_tests--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb emplace_back
struct Timer {
    string name{""};
    time_point<high_resolution_clock> end, start{high_resolution_clock::now()};
    duration<float, std::milli> dur;
    Timer() = default;
    Timer(string nm): name(nm) {}
    ~Timer() {
        end = high_resolution_clock::now(); dur= end - start;
        cout << "@" << name << "> " << dur.count() << " ms" << '\n';
    }
};
template <typename T = int> inline T in()
{
    static T x;
    std::cin >> x;
    return x;
}
std::string yn(bool b)
{
    if(b) return "YES\n";
    else return "NO\n";
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par);
template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector <T>& wek)
{
    for(const auto& i : wek)out << i << ' ';
    return out;
}
template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par)
{
    out << '{'<<par.first<<", "<<par.second<<"}";
    return out;
}
#define show(x) cerr << #x << " = " << x << '\n';
#include "Memory2_lib.h"
constexpr int MAXN = 103;
int fli[MAXN][MAXN];
int fl(int a, int b){
    if(fli[a][b] != -1)return fli[a][b];
    return fli[a][b] = fli[b][a] = Flip(a, b);
}
int ar[MAXN];
int zos[MAXN];
void Solve(int T, int n){
    rep(i, 0, n)zos[i] = 2;
    rep(i, 0, 2*n)ar[i] = -1;
    rep(i, 0, MAXN)rep(j, 0, MAXN)fli[i][j] = -1;
    int a(0), b(1), c(2);
    rep(i, 3, 2*n){
        int d(i);
        if(fl(a, b) == fl(a, c) && fl(a, c) == fl(a, d))swap(a, d);
        else if(fl(b, a) == fl(b, c) && fl(b, c) == fl(b, d))swap(b, d);
        else if(fl(c, a) == fl(c, b) && fl(c, b) == fl(c, d))swap(c, d);
        int f(fl(d, a));
        ar[d] = f;
        --zos[f];
    }
    if(fl(a,b) == fl(b,c) && fl(b,c) == fl(a,c)){
        int dw(-1), je(-1);
        rep(i, 0, n)if(zos[i] == 2)dw = i;
        rep(i, 0, n)if(zos[i] == 1)je = i;
        ar[a] = ar[b] = ar[c] = dw;
        rep(i, 0, 2*n)if(ar[i] == je){
            if(fl(i, a) == je) ar[a] = je;
            if(fl(i, b) == je) ar[b] = je;
            if(fl(i, c) == je) ar[c] = je;
            break;
        }
    }
    else{
        if(fl(b,c)==fl(a,c))swap(a,c);
        else if(fl(b,c)==fl(b,a))swap(a,b);
        ar[a] = fl(a,b);
        --zos[fl(a,b)];
        vector <int> z;
        rep(i, 0, n)while(zos[i]--)z.pb(i);
        if(z[0] == z[1])ar[b] = ar[c] = z[0];
        else{
            rep(i, 0, 2*n)if(ar[i] == z[0]) if(fl(i, b) != fl(i, c)){
                if(fl(i, b) == z[0]){ ar[b] = z[0]; ar[c] = z[1]; }
                else{ ar[b] = z[1]; ar[c] = z[0]; }
                goto end;
            }
            rep(i, 0, 2*n)if(ar[i] == z[1]) if(fl(i, b) != fl(i, c)){
                if(fl(i, b) == z[1]){ ar[b] = z[1]; ar[c] = z[0]; }
                else{ ar[b] = z[0]; ar[c] = z[1]; }
                goto end;
            }
            end:;
        }
    }
    rep(i, 0, n){
        vector <int> v;
        rep(j, 0, 2*n)if(ar[j] == i)v.pb(j);
        Answer(v[0], v[1], i);
    }
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3816kb

Test #2:

score: 0
Accepted
time: 0ms
memory: 3752kb

Test #3:

score: 0
Accepted
time: 0ms
memory: 3732kb

Test #4:

score: 0
Accepted
time: 0ms
memory: 3820kb

Test #5:

score: 0
Accepted
time: 1ms
memory: 3752kb

Test #6:

score: 0
Accepted
time: 0ms
memory: 3700kb

Test #7:

score: 0
Accepted
time: 0ms
memory: 4032kb

Test #8:

score: 0
Accepted
time: 0ms
memory: 3744kb

Subtask #2:

score: 50
Accepted

Test #9:

score: 50
Accepted
time: 1ms
memory: 3756kb

Test #10:

score: 0
Accepted
time: 0ms
memory: 3812kb

Test #11:

score: 0
Accepted
time: 0ms
memory: 3760kb

Test #12:

score: 0
Accepted
time: 0ms
memory: 4044kb

Test #13:

score: 0
Accepted
time: 0ms
memory: 4028kb

Test #14:

score: 0
Accepted
time: 0ms
memory: 4044kb

Test #15:

score: 0
Accepted
time: 0ms
memory: 3760kb

Test #16:

score: 0
Accepted
time: 0ms
memory: 4036kb

Test #17:

score: 0
Accepted
time: 0ms
memory: 3772kb

Test #18:

score: 0
Accepted
time: 0ms
memory: 3760kb

Subtask #3:

score: 40
Accepted

Test #19:

score: 40
Accepted
time: 0ms
memory: 4040kb

Test #20:

score: 0
Accepted
time: 0ms
memory: 4028kb

Test #21:

score: 0
Accepted
time: 0ms
memory: 3992kb

Test #22:

score: 0
Accepted
time: 0ms
memory: 3756kb

Test #23:

score: 0
Accepted
time: 0ms
memory: 3852kb

Test #24:

score: 0
Accepted
time: 0ms
memory: 3756kb

Test #25:

score: 0
Accepted
time: 0ms
memory: 4044kb

Test #26:

score: 0
Accepted
time: 0ms
memory: 4040kb

Test #27:

score: 0
Accepted
time: 0ms
memory: 4048kb

Test #28:

score: 0
Accepted
time: 0ms
memory: 3748kb

Extra Test:

score: 0
Extra Test Passed