QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#386650 | #5108. Prehistoric Programs | PetroTarnavskyi# | WA | 0ms | 3872kb | C++20 | 1.1kb | 2024-04-11 19:05:26 | 2024-04-11 19:05:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
LL m;
__int128 binpow(__int128 q, int n)
{
__int128 res = 1;
FOR(i, 0, n)
{
res *= q;
if(res > m)
return res;
}
return res;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
cin >> m;
vector<__int128> qn;
qn.PB(0);
qn.PB(1);
int Q = 2;
while(true)
{
__int128 val = binpow(Q, n - 1);
if(val > m)
break;
qn.PB(val * Q);
Q++;
}
FOR(q, 2, SZ(qn))
{
RFOR(p, q, 1)
{
__int128 U = m;
U *= (q - p);
auto D = qn[q] - qn[p];
if(U % D == 0)
{
cout << q - p << " " << q << "\n";
return 0;
}
}
}
cout << "impossible\n";
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3872kb
input:
50000 ( ( ))))()))()(()))()()()))()(((((()(((()))()(((()))((()(())))))(()( ) ( ) ((( ( ( ( ( ( () ( ) ( )((())()(( )))))( ( ) )) )() ( ) ) )()( ( ( () ( ) ( )()((((())()))())( ( ( )( ( ( (()())()) ) ) ( ( ( )((())))((())))))))))((((()()))()))))))))((()())())) ) )() ) ) ) ) ) ())(())))))()(()((()(())...
output:
impossible
result:
wrong answer you didn't find a solution but jury did