玄学 TLE
查看原帖
玄学 TLE
643323
weirdoX楼主2024/3/26 11:59

TLE on test#1

#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for (int i = (l); i <= (r); i++)
#define per(i,r,l) for (int i = (r); i >= (l); i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define maxn(a, b) a = max(a, b)
#define minn(a, b) a = min(a, b)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod = 998244353;
mt19937 gen(114514);
ll rp(ll a,ll b) {ll res=1%mod;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

void solve() {
	// init();
	ll n, p, q;
	cin >> n;
	if (!__builtin_parityll(n)) {
		cout << "first" << endl;
		p = n;
		while (true) {
			if (!p && !q) break;
			if (__builtin_parityll(p)) swap(p, q);
			ll v = p&-p;
			cout << v << ' ' << (p ^ v) << endl;
			cin >> p >> q;
		}
	} else {
		cout << "second" << endl;
		while (true) {
			cin >> p >> q;
			if (!p && !q) break;
			if (__builtin_parityll(p)) swap(p, q);
			ll v = p&-p;
			cout << v << ' ' << (p ^ v) << endl;
		}
	}
}

int main() {
	int T;
	scanf("%d", &T);
	while (T--)
		solve();
	return 0;
}
2024/3/26 11:59
加载中...