QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508369#7660. Investigating Frog Behaviour on Lily Pad PatternsUmokWA 0ms3804kbC++201.3kb2024-08-07 14:18:342024-08-07 14:18:35

Judging History

This is the latest submission verdict.

  • [2024-08-07 14:18:35]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3804kb
  • [2024-08-07 14:18:34]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int long long
#define uint unsigned long long
#define lb(x) (x & (-x))
#define endl '\n'
#define INF LONG_LONG_MAX
#define eps 1e-7
const int N = 2e2 + 5;
typedef pair<int, int> PII;
int ar[N];
int p[N];
int n, idx = 0, q;
int find(int x)
{
    int l = 0, r = idx + 1;
    while (l + 1 < r)
    {
        int mid = (l + r) >> 1;
        if (ar[mid] <= x)
            l = mid;
        else
            r = mid;
    }
    return r;
}
void solve()
{
    idx = 0;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        mp[i] = x;
        if (i != 1)
        {
            int x = mp[i - 1] + 1;
            if (x >= mp[i])
                continue;
            for (int j = x; j < mp[i]; j++)
            {
                ar[++idx] = j;
            }
        }
    }
    for (int i = mp[n] + 1; i <= mp[n] + n + 1; i++)
    {
        ar[++idx] = i;
    }

    cin >> q;
    while (q--)
    {
        int x;
        cin >> x;
        int st = find(mp[x]);
        int t = ar[st];
        ar[st] = mp[x];
        mp[x] = t;
        cout << t << endl;
    }
}
signed main()
{

    solve();
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3588kb

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: 0ms
memory: 3592kb

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: 0ms
memory: 3804kb

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
7
5
9
10
3
4
11
10
7
0
5
10
8
9
11
10

result:

wrong answer 14th lines differ - expected: '12', found: '0'