QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#783266#6255. Conveyor Belts353cerega#WA 1ms3564kbC++142.1kb2024-11-26 05:41:132024-11-26 05:41:13

Judging History

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

  • [2024-11-26 05:41:13]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3564kb
  • [2024-11-26 05:41:13]
  • 提交

answer

//#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer","inline")
//#pragma GCC option("arch=native","tune=native","no-zero-upper")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

#define X first
#define Y second


const ll mod = 1000000007;
//const ll mod = 998244353;



ll pew(ll a, ll b) {
    ll res = 1;
    while (b>0) {
        if (b&1) res = res*a%mod;
        b >>= 1;
        a = a*a%mod;
    }
    return res;
}



const ll K = 32;

void solve() {
    ll A, B;
    cin >> A >> B;
    cin >> A >> B;
    int sz = 1;
    vector<vector<int>> ans(300);
    vector<int> prv(2,0);
    vector<ll> W = {A, A+B};
    for (ll i=K-1;i>=0;i--) {
        vector<int> nxt(2,-3);
        if (i==0) nxt[0] = -2, nxt[1] = 0;
        for (int j=0;j<2;j++) {
            if (j+1<2 and W[j]/(1LL<<(i+1))==W[j+1]/(1LL<<(i+1))) continue;
            ll x = W[j]/(1LL<<(i+1))*(1LL<<(i+1));
            int u = sz++, v = sz++;
            ans[prv[j]] = {u,v};
            vector<ll> d(2,-3);
            for (ll b=0;b<2;b++) {
                ll x2 = x+b*(1LL<<i);
                if (x2/(1LL<<i)<W[0]/(1LL<<i)) d[b] = -1;
                if (x2/(1LL<<i)>W[0]/(1LL<<i) and x2/(1LL<<i)<W[1]/(1LL<<i)) d[b] = -2;
                if (x2/(1LL<<i)>W[1]/(1LL<<i)) d[b] = 0;
                if (d[b]!=-3) continue;
                if (x2/(1LL<<i)==W[1]/(1LL<<i)) {
                    if (nxt[1]==-3) nxt[1] = sz++;
                    d[b] = nxt[1];
                    continue;
                }
                if (x2/(1LL<<i)==W[0]/(1LL<<i)) {
                    if (nxt[0]==-3) nxt[0] = sz++;
                    d[b] = nxt[0];
                    continue;
                }
            }
            ans[u] = {0,d[0]};
            ans[v] = {d[1],0};
        }
        prv = nxt;
    }
    cout << sz << "\n";
    for (int i=0;i<sz;i++) {
        cout << ans[i][0] << " " << ans[i][1] << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    int T = 1;
    //cin >> T;
    while (T--) solve();
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3564kb

input:

2 3
3 2

output:

102
1 2
0 3
0 0
4 5
0 6
0 0
7 8
0 9
0 0
10 11
0 12
0 0
13 14
0 15
0 0
16 17
0 18
0 0
19 20
0 21
0 0
22 23
0 24
0 0
25 26
0 27
0 0
28 29
0 30
0 0
31 32
0 33
0 0
34 35
0 36
0 0
37 38
0 39
0 0
40 41
0 42
0 0
43 44
0 45
0 0
46 47
0 48
0 0
49 50
0 51
0 0
52 53
0 54
0 0
55 56
0 57
0 0
58 59
0 60
0 0
61 62...

result:

wrong answer Output produces incorrect ratio.