QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96426#5154. ETASa3tElSefr#WA 10ms3692kbC++142.0kb2023-04-13 21:20:492023-04-13 21:20:50

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 21:20:50]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3692kb
  • [2023-04-13 21:20:49]
  • 提交

answer

///Etfsh5t nseet el rank
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i, a, b) for (int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x, y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll

using ll = long long;
using ull = unsigned long long;
using uint = uint32_t;
using ii = pair<int, int>;

const int N = 2e5 + 5, A = 12, LG = 18, MOD = (119 << 23) + 1;
const long double PI = acos(-1);
const long double EPS = 1e-9;
const int INF = 1e18;
string str = string(5000, '0');
const int MX = 100;
void doWork()
{
    int a, b;
    scanf("%d/%d", &a, &b);
    for (int n = 1; n <= 1000000; n++)
    {
        ///a/b = sum/n
        if ((a * n) % b == 0)
        {

            int sum = a * n / b;
            if (sum <= n * (n - 1) / 2 && sum >= (n - 1))
            {
                cout << n << ' ' << n - 1 << endl;
                int cur = 2;
                sum -= (n - 1);
                while (sum >= (cur - 2))
                {
                    sum -= (cur - 2);
                    cout << cur - 1 << ' ' << cur << '\n';
                    cur += 1;
                }
                for (int i = cur; i >= 0; --i)
                {
                    while (sum >= i && cur <= n)
                    {
                        cout << i + 1 << ' ' << cur << '\n';
                        cur += 1;
                        sum -= i;
                    }
                }
                return;
            }
        }
    }
    cout << "impossible\n";
}
int32_t main()
{
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif // ONLINE_JUDGE

    int t = 1;
    // cin >> t;
    while (t--)
    {
        doWork();
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 10ms
memory: 3692kb

input:

1/2

output:

impossible

result:

wrong output format Expected integer, but "impossible" found