QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549479#9223. Data Determinationlinxin114WA 62ms5172kbC++141.6kb2024-09-06 16:14:002024-09-06 16:14:00

Judging History

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

  • [2024-09-06 16:14:00]
  • 评测
  • 测评结果:WA
  • 用时:62ms
  • 内存:5172kb
  • [2024-09-06 16:14:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sc scanf
#define dl double
#define pr printf
long long gcd(long long a, long long b)
{
    if (a < b)
        swap(a, b); // 如果b大的话就交换值 让b%a
    if (b == 0)     // 除到最后 如果返回的值是1 说明两个数互质
        return a;
    else
        return gcd(a % b, b);
}
long long mod_inv(long long x, long long mod)
{
    long long result = 1;
    long long power = mod - 2;
    while (power > 0)
    {
        if (power % 2 == 1)
        {
            result = (result * x) % mod;
        }
        x = (x * x) % mod;
        power /= 2;
    }
    return result;
}
ll a[200005];
int main()
{
    ll t;
    cin >> t;
    while(t--){
        ll n, k, m;
        cin >> n >> k >> m;
        ll x=0;
        for (ll i = 1; i <= n;i++){
            cin>>a[i];
        }
        sort(a+1, a + n+1);
        ll flag = 0;
        if(k%2==1){
            for (ll i = k / 2 + 1; i <= n - k / 2 - 1;i++){
                if(a[i]==m){
                    flag = 1;
                }
            }
        }
        else{
        	ll k=0;
            for (ll i = k / 2; i <= n - k / 2; i++)
            {
            	if(a[i+1]==m){
            		k++;
				}
                if (a[i]+a[i+1+k] == m*2)
                {
                    flag = 1;
                }
                if(k==2){
                	flag=1;
				}
            }
        }
        if(flag==1){
            cout << "TAK" << endl;
        }
        else{
            cout << "NIE" << endl;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 62ms
memory: 5172kb

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: 58ms
memory: 3792kb

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
NIE
TAK
NIE
NIE
NIE
NIE
NIE
NIE

result:

wrong answer 3rd lines differ - expected: 'TAK', found: 'NIE'