QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749095#5511. Minor Evilagh4WA 1ms3504kbC++231.2kb2024-11-14 22:38:072024-11-14 22:38:09

Judging History

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

  • [2024-11-14 22:38:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3504kb
  • [2024-11-14 22:38:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int z;
    cin >> z;
    while (z--){
        int n, k;
        cin >> n >> k;
        vector<pair<int, int>> S;
        for(int i = 0; i<k; i++){
            int a, b;
            cin >> a >> b;
            S.push_back({a, b});
        }
        int s;
        cin >> s;
        set<int> martwi;
        for(int i=0;i<s;i++) {
            int tmp;
            cin>>tmp;
            martwi.insert(tmp);
        }
        vector<char> ans;
        reverse(S.begin(), S.end());
        for(auto [a, b]:S) {
            if(martwi.find(a) == martwi.end()) {
                if(martwi.find(b) != martwi.end()) {
                    ans.push_back('T');
                    martwi.erase(b);
                }
            } else {
                ans.push_back('N');
            }
        }
        if(martwi.size() == 0) {
            cout<<"TAK\n";
            reverse(ans.begin(), ans.end());
            for(auto x:ans) cout<<x;
            cout<<'\n';
        } else {
            cout<<"NIE\n";
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3504kb

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

result:

wrong answer wrong length (test case 1)