QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#133049#5154. ETARabeya#WA 8ms26904kbC++201.3kb2023-08-01 14:07:202023-08-01 14:07:23

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-01 14:07:23]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:26904kb
  • [2023-08-01 14:07:20]
  • 提交

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]