QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#581142 | #9381. 502 Bad Gateway | deerdoomer | RE | 0ms | 18764kb | C++14 | 4.1kb | 2024-09-22 09:58:26 | 2024-09-22 09:58:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
#define I return
#define AK 0
#define XCPC ;
#define AL(X) (X).begin() + 1, (X).end()
#define ALL(X) (X).begin(), (X).end()
ll n, m, k;
ll base = 131;
ll mod = 998244353;
vector<pair<ll,ll>> v;
vector<vector<ll>> v1;
vector<ll> cnt;
vector<ll> ck;
vector<ll> STree;
vector<ll> lazy;
db eps = 1e-9;
ll ans;
ll ans1;
ll ck1;
inline ll qpow(ll x, ll y, ll p) // y的x次方
{
ll ans = 1;
while (x)
{
if (x & 1)
{
ans *= y;
ans %= p;
}
y *= y;
y %= p;
x >>= 1;
}
return ans % p;
}
inline ll inv(ll x) // 素数逆元
{
return qpow(mod - 2, x, mod) % mod;
}
inline ll gcd(ll x, ll y) // 最大公因数
{
if (x < y)
return gcd(y, x);
if (y == 0)
return x;
else
return gcd(y, x % y);
}
inline ll find(ll x) // 并查集
{
if (cnt[x] == x)
return x;
return cnt[x] = find(cnt[x]);
}
inline ll ask(string x)
{
cout << "? " << x << endl;
fflush(stdout);
ll ans;
cin >> ans;
return ans;
}
inline void answer(string x)
{
cout << "! " << x << endl;
fflush(stdout);
}
inline ll sqr(pair<ll, ll> a, pair<ll, ll> b) // 计算距离
{
return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second);
}
inline void StateCompressionDP() // 状压dp
{
cin >> n;
vector<pair<string, string>> v(n + 1);
for (ll i = 1; i <= n; i++)
{
cin >> v[i].first >> v[i].second;
}
vector<vector<ll>> edge(n + 1, vector<ll>(n + 1, 0));
for (ll i = 1; i <= n; i++)
{
for (ll j = i + 1; j <= n; j++)
{
if (i == j)
continue;
if (v[i].first == v[j].first)
{
edge[i][j] = 1;
edge[j][i] = 1;
}
if (v[i].second == v[j].second)
{
edge[i][j] = 1;
edge[j][i] = 1;
}
}
}
vector<vector<ll>> dp(n + 2, vector<ll>(1ll << n, 0));
for (ll i = 1; i <= n; i++)
{
dp[i][1ll << (i - 1)] = 1;
}
ll ans = 1;
for (ll j = 1; j < (1ll << n); j++)
{
for (ll i = 1; i <= n; i++)
{
if (((1ll << (i - 1)) & j) == 0)
continue;
for (ll k = 1; k <= n; k++)
{
if (((1ll << (k - 1)) & j) == 0)
continue;
if (i == k)
continue;
if (edge[i][k] == 1)
{
dp[i][j] = max(dp[k][j - (1ll << (i - 1))] + 1, dp[i][j]);
ans = max(ans, dp[i][j]);
}
}
}
}
cout << n - ans << endl;
}
/*
inline void build(ll a, ll b, ll x) // 线段树模板
{
if (a == b)
{
STree[x] = v[a];
return;
}
ll y = a + ((b - a) >> 1);
build(a, y, x * 2);
build(y + 1, b, x * 2 + 1);
STree[x] = STree[x * 2] + STree[x * 2 + 1];
}
inline ll getsum(ll l, ll r, ll s, ll t, ll p) // 线段树区间和
{
if (l <= s && t <= r)
{
return STree[p];
}
ll m = s + ((t - s) >> 1);
if (lazy[p])
{
STree[p * 2] += lazy[p] * (m - s + 1);
STree[p * 2 + 1] += lazy[p] * (t - m);
lazy[p * 2] += lazy[p];
lazy[p * 2 + 1] += lazy[p];
lazy[p] = 0;
}
ll sum = 0;
if (l <= m)
sum += getsum(l, r, s, m, p * 2);
if (r > m)
sum += getsum(l, r, m + 1, t, p * 2 + 1);
return sum;
}
inline void update(ll l, ll r, ll c, ll s, ll t, ll p)
{
if (l <= s && t <= r)
{
STree[p] += (t - s + 1) * c;
lazy[p] += c;
return;
}
ll m = s + ((t - s) >> 1);
if (lazy[p] && s != t)
{
STree[p * 2] += lazy[p] * (m - s + 1);
STree[p * 2 + 1] += lazy[p] * (t - m);
lazy[p * 2] += lazy[p];
lazy[p * 2 + 1] += lazy[p];
lazy[p] = 0;
}
if (l <= m)
{
update(l, r, c, s, m, p * 2);
}
if (r > m)
{
update(l, r, c, m + 1, t, p * 2 + 1);
}
STree[p] = STree[p * 2] + STree[p * 2 + 1];
}
*/
inline void solve()
{
cin >> n;
if(v[n].first % 2 == 0)
{
cout << v[n].first / 2 << " " << 1 << endl;
}
else
{
cout << v[n].first << " " << 2 << endl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll tt = 1;
cin >> tt;
v.resize(1e6+1,{0,0});
v[1] = {2,2};
for(ll i = 2;i<=1e6;i++)
{
v[i] = {v[i-1].first + 1 , 2};
}
while (tt--)
{
solve();
}
I AK XCPC
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 18764kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Runtime Error
input:
1000000 1 1000000000 1 1 1000000000 1 1000000000 1 1 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1 1000000000 1 1000000000 1000000000 1000000000 1000000000 1 1 1 10000000...
output:
1 1