QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508402#7660. Investigating Frog Behaviour on Lily Pad PatternsAu_GoldWA 73ms30444kbC++201.2kb2024-08-07 14:47:512024-08-07 14:47:51

Judging History

This is the latest submission verdict.

  • [2024-08-07 14:47:51]
  • Judged
  • Verdict: WA
  • Time: 73ms
  • Memory: 30444kb
  • [2024-08-07 14:47:51]
  • Submitted

answer

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<string>
#include<iomanip>
#include<cmath>
#include<set>
using namespace std;
using ll = long long;
#define int ll

const int mxn = 1e6 + 2e5 + 5;

vector<int> v;

void solve()
{
    int n;
    cin >> n;
    vector<int> v, vv(mxn);
    for (int i = 0; i <= mxn; i++)
    {
        v.push_back(i);
    }
    for (int i = 1; i <= n; i++)
    {
        int p;
        cin >> p;
        vv[i] = p;
        int pos = upper_bound(v.begin(), v.end(), p) - v.begin() - 1;
        v.erase(v.begin() + pos);
    }
    int q;
    cin >> q;
    while (q--)
    {
        int idx;
        cin >> idx;
        int p = vv[idx];
        int pp = upper_bound(v.begin(), v.end(), p) - v.begin();
        cout << v[pp] << endl;
        v.erase(v.begin() + pp);
        int pos = upper_bound(v.begin(), v.end(), p) - v.begin() - 1;
        v.insert(v.begin() + pos, p);
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int T = 1;
    //cin >> T;
    while (T--)
    {
        solve();
    }

    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 30ms
memory: 30236kb

input:

5
1 2 3 5 7
3
1
2
4

output:

4
6
8

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 33ms
memory: 30444kb

input:

5
1 2 3 5 7
4
1
1
1
1

output:

4
6
8
9

result:

ok 4 lines

Test #3:

score: -100
Wrong Answer
time: 73ms
memory: 29188kb

input:

5
1 2 3 4 5
20
1
4
4
3
5
3
3
5
2
2
5
4
1
4
2
3
1
5
3
3

output:

6
7
8
4
9
10
11
12
4
3
13
5
5
14
15
16
3
17
18
19

result:

wrong answer 5th lines differ - expected: '7', found: '9'