QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#562144#9223. Data Determinationtien_noobWA 27ms4468kbC++142.2kb2024-09-13 15:19:132024-09-13 15:19:14

Judging History

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

  • [2024-09-13 15:19:14]
  • 评测
  • 测评结果:WA
  • 用时:27ms
  • 内存:4468kb
  • [2024-09-13 15:19:13]
  • 提交

answer

//Make CSP great again
//Vengeance
#include <bits/stdc++.h>
#define TASK "TESTCODE"
using namespace std;
const int N = 2e5;
int n, k, m;
int a[N + 1];
int cnt[3];
void read()
{
    cin >> n >> k >> m;
    for (int i = 1; i <= n; ++ i)
    {
        cin >> a[i];
        a[i] -= m;
    }
}
void solve()
{
    sort(a + 1, a + n + 1);
    if (k & 1)
    {
        for (int i = 1; i <= n; )
        {
            int j = i;
            while (j <= n && a[j] == a[i])
            {
                ++j;
            }
            int x = i - 1;
            int y = j - i;
            int z = n - j + 1;
            --y;
            i = j;
            if (a[i - 1] != 0)
            {
                continue;
            }
            int t = min(x, z);
            k -= t;
            k -= y/2 * 2;
            k -= 1;
            if (k <= 0)
            {
                cout << "TAK" << '\n';
                return ;
            }
        }
        cout << "NIE" << '\n';
    }
    else
    {
        for (int i = 1; i <= n; ++ i)
        {
            if (a[i] > 0)
            {
                break;
            }
            if (a[i] == 0)
            {
                if (i == n)
                {
                    break;
                }
                if (a[i + 1] == a[i])
                {
                    cout << "TAK" << '\n';
                    return ;
                }
                break;
            }
            int j = lower_bound(a + 1, a + n + 1, -a[i]) - a;
            if (j < 1 || j > n || a[j] != -a[i])
            {
                continue;
            }
            int x = i - 1, z = n - j + 1;
            if (min(x, z) * 2 + 2 >= k)
            {
                cout << "TAK" << '\n';
                return ;
            }
        }
        cout << "NIE" << '\n';
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    if (fopen(TASK".INP", "r"))
    {
        freopen(TASK".INP", "r", stdin);
    }
    int t = 1;
    bool typetest = true;
    if (typetest)
    {
        cin >> t;
    }
    for (int __ = 1; __ <= t; ++ __)
    {
        //cout << "Case " << __ << ": ";
        read();
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
6 4 42
41 43 41 57 41 42
4 2 4
1 2 5 8
7 5 57
101 2 42 5 57 7 13

output:

TAK
NIE
NIE

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 27ms
memory: 4468kb

input:

1
200000 2 482043846
410684388 380438852 309193412 468460689 586281084 680820569 266819813 639025900 488292166 503516930 532292185 618277661 728546481 628339224 673945619 471325257 372807753 325778059 372151033 548358519 276494019 336701079 320784795 377493322 385262271 621712987 349634764 668994576...

output:

NIE

result:

ok single line: 'NIE'

Test #3:

score: -100
Wrong Answer
time: 22ms
memory: 3756kb

input:

10
20000 3530 502140211
367996343 553577602 581694419 435810361 532394401 431613294 485360190 608191058 506969937 531905607 429252296 360241499 519031654 250454430 478548102 753825992 450326073 603766643 566036856 511634983 416622101 753825992 753825992 380511285 390746506 436237616 342529443 878920...

output:

NIE
TAK
TAK
TAK
TAK
NIE
NIE
NIE
NIE
NIE

result:

wrong answer 4th lines differ - expected: 'NIE', found: 'TAK'