QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#786934#124. Librarythangthang0 38ms3948kbC++202.0kb2024-11-27 02:09:002024-11-27 02:09:01

Judging History

This is the latest submission verdict.

  • [2024-11-27 02:09:01]
  • Judged
  • Verdict: 0
  • Time: 38ms
  • Memory: 3948kb
  • [2024-11-27 02:09:00]
  • Submitted

answer

// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#include "library.h"
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int N = 1e5 + 5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

// grader

//int n, p[N];
//
//int Query(vector <int> qr){
//    int ans = 0;
//    for (int i = 1; i <= n; ++ i) if (qr[p[i]] == 1 && (i == 1 || !qr[p[i - 1]])) ++ ans;
//    return ans;
//}
//
//void Answer(vector <int> ans){
//    for (int f : ans) cout << f << ' ';
//}

// end

void Solve(int n){
    vector <int> a(n);
    iota(a.begin(), a.end(), 0);

    auto del = [&](int x) -> void {
        a.erase(a.begin() + x);
    };

    vector <int> qr(n, 1);
    int st = 0;
    for (int i = 1; i < n; ++ i){
        qr[i] = 0;
        if (Query(qr) == 1){
            st = i;
            break;
        }
        qr[i] = 1;
    }

    vector <int> ans = {st};
    del(st);
    for (int loops = 1; loops < n; ++ loops){
        int l = 1, r = a.size() - 1, g = 0;
        while (l <= r){
            int mid = l + r >> 1;
            qr.assign(n, 0);
            for (int i = 0; i <= mid; ++ i) qr[a[i]] = 1;
            int res = Query(qr);
            qr[ans.back()] = 1;
            if (res == Query(qr)) g = mid, r = mid - 1;
            else l = mid + 1;
        }
        ans.push_back(a[g]);
        del(g);
    }

    for (int &f : ans) f ++;
    Answer(ans);
}

//void solve(){
//    cin >> n;
//    for (int i = 1; i <= n; ++ i) cin >> p[i], p[i] --;
//    Solve(n);
//}
//
//int main(){
//    if (fopen("Library.inp", "r")){
//        freopen("Library.inp", "r", stdin);
//        freopen("Library.out", "w", stdout);
//    }
//    ios_base::sync_with_stdio(0);
//    cin.tie(0); cout.tie(0);
//
//    int t = 1; // cin >> t;
//    while (t --) solve();
//    return 0;
//}


詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3948kb

input:

192
17
6
145
10
132
34
129
8
137
157
65
54
138
85
60
190
52
75
179
23
167
41
117
186
165
26
111
73
49
92
3
81
96
11
152
45
56
33
182
15
130
166
105
19
158
159
156
149
169
153
106
134
114
148
124
80
28
68
184
62
104
67
150
128
175
116
144
183
189
151
173
39
108
71
79
5
47
99
162
163
177
69
20
136
82
...

output:

Wrong Answer [8]

result:

wrong answer 

Subtask #2:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 38ms
memory: 3612kb

input:

1000
972
265
212
27
724
465
50
304
37
134
246
257
177
482
90
974
616
221
151
912
946
366
590
277
187
976
394
765
643
740
385
665
749
585
923
92
920
994
48
405
978
893
477
381
788
992
825
680
785
297
679
116
836
31
333
714
828
922
492
890
919
237
188
677
557
522
867
368
19
690
29
632
832
17
107
485
3...

output:

Wrong Answer [8]

result:

wrong answer