QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#75292#4996. Icy ItineraryAlinxesterWA 2ms3628kbC++142.1kb2023-02-04 19:35:012023-02-04 19:35:05

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-04 19:35:05]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3628kb
  • [2023-02-04 19:35:01]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define HuMo long long
#define N ((HuMo)2e2 + 2)
#define HuTao ((HuMo)1e3 + 2)
#define INF ((HuMo)2e18 + 2)
#define base 23333
#define mod ((HuMo)1e9 + 7)
#define db double
#define eps 1e-8
#define lowbit(x) (x&-x)
#define rep(i,x,y) for (HuMo i = (x); i <= (y); ++i)
#define drep(i,x,y) for (HuMo i = (x); i >= (y); --i)
#define go(i,u) for (HuMo i = head[u]; i; i = edge[i].next)
#define go_(i,u) for (HuMo i = head[u]; ~i; i = edge[i].next)
#define pii pair<HuMo, HuMo>
#define MP make_pair
#define fir first
#define sec second
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T> inline T rnd(T l,T r) {return uniform_int_distribution<T>(l , r)(rng);}
template<typename T> inline void read (T &t) {
	t = 0; char f = 0, ch = getchar(); long db d = 0.1;
	while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
	while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
	if (ch == '.') {
		ch = getchar();
		while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
	}
	t = (f ? -t : t);
}
template <typename T, typename... Args>
	inline void read (T& t, Args&... args) { read(t); read(args...); }
inline void write (HuMo x) {
	if (x >= 10) write(x / 10);
	printf("%lld", (long long)x % 10);
}
int n, m, a, b;
set<pii > s;
vector<int> x, y;
bool fg;
signed main() {
	read(n, m);
	rep (i, 1, m) {
		read(a, b);
		s.insert(MP(a, b));
	}
	x = {1, 2};
	fg = s.count(MP(1, 2));
	rep (i, 3, n) {
		if (s.count(MP(x.back(), i)) == fg) {
			x.emplace_back(i);
			if (!y.empty() && s.count(MP(y.back(), i)) == fg)
				x.emplace_back(y.back()), y.pop_back();
		}
		else {
			y.emplace_back(x.back());
			x.pop_back();
			if (s.count(MP(x.back(), i)) == fg) x.emplace_back(i);
			else {
				y.emplace_back(i);
				if ((int)x.size() == 1) {
					fg ^= 1;
					while (!y.empty()) x.emplace_back(y.back()), y.pop_back();
				}
			}
		}
	}
	for (auto t : x) printf("%lld ", t);
	drep (i, (int)y.size() - 1, 0) printf("%lld ", y[i]);
	printf("\n");
return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3552kb

input:

4 4
1 2
1 3
1 4
3 4

output:

1 3 4 2 

result:

ok qwq

Test #2:

score: 0
Accepted
time: 2ms
memory: 3628kb

input:

5 0

output:

1 2 3 4 5 

result:

ok qwq

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3604kb

input:

10 10
7 8
7 5
5 2
6 1
10 7
4 6
5 8
3 2
10 5
1 10

output:

1 2 3 4 5 6 8 9 7 10 

result:

wrong answer Changed color too many times (3)