QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197263#5511. Minor EvilAlfehWA 0ms3596kbC++141.0kb2023-10-02 13:51:352023-10-02 13:51:35

Judging History

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

  • [2023-10-02 13:51:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2023-10-02 13:51:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int sz = 1e5 + 5, mod = 1e9 + 7;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1; cin >> t;
    while(t--) {
        int n, k; cin >> n >> k;
        std::vector<pair<int,int>> v(k);
        for(auto &[a, b]:v) cin >> a >> b;
        int s; cin >> s;
        std::vector<int> v1(n + 1),  v2(n + 1), v3(n + 1);
        for(int i = 0; i < s; i++) {
            int a; cin >> a;
            v1[a] = 1; 
        }
        string ans(k, 'N');
        for(int i = k - 1; i >= 0; i--) {
            if(v2[v[i].second] || !v1[v[i].second]) continue;
            if(v3[v[i].second]) continue;
            ans[i] = 'T';
            v2[v[i].second] = 1;
            v3[v[i].first] = 1;
        }
        int pos = 1;
        for(int i = 1; i <= n; i++)
            pos&=(v2[i] >= v1[i]);
        if(pos) {
            cout << "TAK\n" << ans << "\n";
        } else cout << "NTE\n";
    }
    return 0; 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3596kb

input:

2
5 6
1 2
2 1
2 5
2 3
2 4
4 2
3
1 2 3
3 2
1 2
2 3
2
2 3

output:

TAK
NTNTNT
NTE

result:

wrong answer No TAK/NIE in the contestant output (test case 2)