QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426768#403. Memory2oscaryang100 ✓1ms3912kbC++20974b2024-05-31 20:23:332024-05-31 20:23:33

Judging History

This is the latest submission verdict.

  • [2024-05-31 20:23:33]
  • Judged
  • Verdict: 100
  • Time: 1ms
  • Memory: 3912kb
  • [2024-05-31 20:23:33]
  • Submitted

answer

#include "Memory2_lib.h"
#include<bits/stdc++.h>

#define pii pair<int, int>
#define mkp make_pair
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)

using namespace std;

const int N = 55;

int n;
set <pii> S[N];

inline void add (int x, int y) { S[Flip (x, y)].insert (mkp (x, y)); }

inline int getnxt () {
	rep (i, 0, n - 1) if (S[i].size () > 1) return i;
	return - 1;
}

void Solve(int sid, int nn){
	n = nn;
	for (int i = 0; i < 2 * n; i += 2) add (i, i + 1);
	
	int w;
	while ((w = getnxt ()) != - 1) {
		auto [u, v] = *S[w].begin ();
		auto [x, y] = *S[w].rbegin ();
		S[w].clear ();
		if (Flip (u, x) != w)      Answer (v, y, w), add (u, x);
		else if (Flip (u, y) != w) Answer (v, x, w), add (u, y);
		else if (Flip (v, x) != w) Answer (u, y, w), add (v, x);
		else 			   Answer (u, x, w), add (v, y);
	}
	
	rep (i, 0, n - 1) if (!S[i].empty ()) {
		auto [u, v] = *S[i].begin ();
		Answer (u, v, i);
	}
	
	
	return;
}

Details

Subtask #1:

score: 10
Accepted

Test #1:

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

Test #2:

score: 10
Accepted
time: 0ms
memory: 3836kb

Test #3:

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

Test #4:

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

Test #5:

score: 10
Accepted
time: 0ms
memory: 3868kb

Test #6:

score: 10
Accepted
time: 0ms
memory: 3844kb

Test #7:

score: 10
Accepted
time: 0ms
memory: 3868kb

Test #8:

score: 10
Accepted
time: 0ms
memory: 3908kb

Subtask #2:

score: 50
Accepted

Test #9:

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

Test #10:

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

Test #11:

score: 50
Accepted
time: 0ms
memory: 3864kb

Test #12:

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

Test #13:

score: 50
Accepted
time: 0ms
memory: 3868kb

Test #14:

score: 50
Accepted
time: 0ms
memory: 3908kb

Test #15:

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

Test #16:

score: 50
Accepted
time: 0ms
memory: 3864kb

Test #17:

score: 50
Accepted
time: 0ms
memory: 3780kb

Test #18:

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

Subtask #3:

score: 40
Accepted

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

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

Test #23:

score: 40
Accepted
time: 1ms
memory: 3848kb

Test #24:

score: 40
Accepted
time: 1ms
memory: 3768kb

Test #25:

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

Test #26:

score: 40
Accepted
time: 1ms
memory: 3772kb

Test #27:

score: 40
Accepted
time: 1ms
memory: 3788kb

Test #28:

score: 40
Accepted
time: 1ms
memory: 3772kb

Extra Test:

score: 0
Extra Test Passed