QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#133049 | #5154. ETA | Rabeya# | WA | 8ms | 26904kb | C++20 | 1.3kb | 2023-08-01 14:07:20 | 2023-08-01 14:07:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define ld long double
const int N = 1e6 + 5;
const ld eps = 0.00000001;
vector<int> dis[N];
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
string s;
cin>> s;
string x = "";
string y = "";
int i=0;
for(; i<s.size() && s[i] != '/'; i++) x += s[i];
i++;
for(; i<s.size(); i++) y += s[i];
int a = stoi(x);
int b = stoi(y);
int n = -1, tot;
for(int i=1; i<=1000000; i++) {
if(i%b) continue;
tot = a * (i/b);
if(i-1 <= tot && tot <= i*(i-1)/2) {
n = i;
break;
}
}
if(n==-1) {
cout<< "impossible" << endl;
return 0;
}
cout<< tot << endl;
dis[0].push_back(1);
int curDepth = 0, curTot = 0;
vector<pair<int,int>> ans;
for(int i=2; i<=n; i++) {
int left = n-i;
int now = min(curDepth+1, tot-left-curTot);
curTot += now;
dis[now].push_back(i);
ans.push_back({dis[now-1].back(), i});
curDepth = max(curDepth, now);
}
cout<< n << " " << ans.size() << endl;
for(auto e: ans) cout<< e.first << " " << e.second << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 8ms
memory: 26904kb
input:
1/2
output:
1 2 1 1 2
result:
wrong answer Integer parameter [name=x] equals to 2, violates the range [1, 1]