QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96423#5154. ETASa3tElSefr#WA 2ms3720kbC++142.4kb2023-04-13 21:18:272023-04-13 21:19:39

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:19:39]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3720kb
  • [2023-04-13 21:18:27]
  • 提交

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');
int ptr = 0;
bool ask(string x)
{
    if (x == "left")
    {
        ptr = (ptr + str.size() - 1) % str.size();
        return str[ptr] - '0';
    }

    if (x == "right")
    {
        ptr = (ptr + 1) % str.size();
        return str[ptr] - '0';
    }
    if (x == "flip")
    {
        str[ptr] ^= 1;
        return str[ptr] - '0';
    }
    cout << "? " << x << endl;
    bool ret;
    cin >> ret;
    return ret;
}
const int MX = 100;
void doWork()
{
    int a, b;
    scanf("%d/%d", &a, &b);
    for (int n = 1; n <= 10; 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: 100
Accepted
time: 0ms
memory: 3720kb

input:

1/2

output:

2 1
1 2

result:

ok 

Test #2:

score: 0
Accepted
time: 2ms
memory: 3692kb

input:

1/3

output:

impossible

result:

ok 

Test #3:

score: 0
Accepted
time: 2ms
memory: 3472kb

input:

7/4

output:

8 7
1 2
2 3
3 4
4 5
2 6
1 7
1 8

result:

ok 

Test #4:

score: -100
Wrong Answer
time: 2ms
memory: 3720kb

input:

974/975

output:

impossible

result:

wrong output format Expected integer, but "impossible" found