QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549471#9223. Data Determinationclearlove13#WA 30ms5156kbC++232.1kb2024-09-06 16:01:092024-09-06 16:01:09

Judging History

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

  • [2024-09-06 16:01:09]
  • 评测
  • 测评结果:WA
  • 用时:30ms
  • 内存:5156kb
  • [2024-09-06 16:01:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ull = unsigned long long;
#define ff(x) fixed << setprecision(x)
#define vel vector<long long>
#define vei vector<int>
#define ves vector<string>
#define asn ans
constexpr int inf = 0x3f3f3f3f;
constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr db EPS = 1.0e-9;
constexpr ll MOD = 998244353LL;
constexpr ll SZ = 1e6;
constexpr ll MAXN5 = 2e5 + 5;
constexpr ll MAXN6 = 2e6 + 5;
ll n, m;

void Solve(void) {
    ll k, mid;
    cin >> n >> k >> mid;
    vector<ll> v;
    for (int i = 1; i <= n; i++) {
        ll x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    if (k % 2 == 1) {
        int xia = lower_bound(v.begin(), v.end(), mid) - v.begin();
        if (xia != v.end() - v.begin() && v[xia] == mid) {
            for (xia; xia < v.size(); xia++) {
                if (v[xia] == mid) {
                    if (xia >= k / 2 && v.size() - 1 - xia >= k / 2) {
                        cout << "TAK" << '\n';
                        return;
                    }
                } else {
                    break;
                }
            }
        }
    } else {
        for (int i = 0; i < v.size(); i++) {
            if(v[i]>mid){
                break;
            }
            int xia1 =
                lower_bound(v.begin(), v.end(), 2 * mid - v[i]) - v.begin();
           
              
            if (xia1 != v.end() - v.begin() && v[xia1] == 2 * mid - v[i]) {
                // cout << i << ' ' << xia1 << '\n';
                if (i >= (k / 2) - 1 && n - xia1 - 1 >= (k / 2) - 1) {
                    cout << "TAK" << '\n';
                    return;
                }
            }
        }
    }
    cout << "NIE" << '\n';
}
int main(void) {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // 	freopen("mine.in", "r", stdin);
    // 	freopen("mine.out", "w", stdout);

    int cas = 1;
    cin >> cas;
    while (cas--)
        Solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 30ms
memory: 5156kb

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: 24ms
memory: 3908kb

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

result:

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