QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#873402 | #5154. ETA | enze114514 | WA | 1ms | 3712kb | C++20 | 1.7kb | 2025-01-26 13:01:01 | 2025-01-26 13:01:02 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ld = long double;
using ll = long long;
#define pb push_back
const ld pi = 3.14159265358979323846;
const int mod = (int)1e9 + 7;
const ll INF = 1e18;
template<typename T>
T chmax(T a, T b){
return a > b ? a : b;
}
template<typename T>
T chmin(T a, T b){
return a > b ? b : a;
}
const int N = (int)2e5 + 1, M = N * 2;
void solve(){
string s;
cin >> s;
int a = 0, b = 0;
for(int i = 0; i < s.size(); i++){
if(s[i] == '/'){
a = b;
b = 0;
}
else{
b = b * 10 + s[i] - '0';
}
}
a = a / __gcd(a, b);
b = b / __gcd(a, b);
while(b <= 1e6){
if(a % (b - 1) == 0){
break;
}
a = a * 2;
b = b * 2;
}
if(b > 1e6){
cout << "Impossible" << endl;
}
else{
vector<vector<int>> v;
int id = 2;
ll qwq = 1;
while(a > 0){
if(qwq > a){
v.pb({1, id});
qwq = 1;
}
else{
v.pb({id - 1, id});
}
a -= qwq;
++id, ++qwq;
}
cout << v.size() + 1 << " " << v.size() << endl;
for(auto e : v){
cout << e[0] << " " << e[1] << endl;
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
input:
1/2
output:
2 1 1 2
result:
ok
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3712kb
input:
1/3
output:
Impossible
result:
wrong answer Token "Impossible" doesn't correspond to pattern "impossible"