QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197306#5511. Minor EvilAlfehWA 0ms3620kbC++141.1kb2023-10-02 14:21:062023-10-02 18:59:27

Judging History

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

  • [2023-10-02 18:59:27]
  • 管理员手动重测该提交记录
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2023-10-02 14:21:06]
  • 提交

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;
            if(v1[v[i].first] > v2[v[i].first]) 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: 3620kb

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)