QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#574633#9320. Find the Easiest ProblemxingliuWA 10ms3656kbC++201.5kb2024-09-18 23:23:382024-09-18 23:23:40

Judging History

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

  • [2024-09-18 23:23:40]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3656kb
  • [2024-09-18 23:23:38]
  • 提交

answer

/**
 *  author: xing huan liu kong 
 *  created: 2024-09-18 23:16:29
 *  
 *  即使这个图论(world)大的无边无际
 *  我也会深度优先搜索(dfs)找到你..
**/
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'  
using namespace std;

#define int long long
typedef pair<int, int> PII;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;

void solve()
{
    int n;
    cin >> n;

    map<string, set<string>> ma;
    int ans = 0;

    while (n -- ) {
        string a, b, c;
        cin >> a >> b >> c;

        if (c == "accepted") {
            ma[b].insert(a);
            ans = max(ans, (int)ma[b].size());
        }
    }

    string t = "#";

    for (auto [u, se] : ma) {
        if ((int)se.size() == ans) {
            if (t == "#") t = u;
            else {
                vector<string> v1, v2;
                for (auto i : ma[u]) v1.push_back(i);
                for (auto i : ma[t]) v2.push_back(i);
                for (int i = 0; i < v1.size(); i ++ ) {
                    if (v1[i] < v2[i]) {
                        t = u;
                        break;
                    }
                    else if (v1[i] > v2[i]) {
                        break;
                    }
                }
            }
        }
    }

    cout << t << endl;

}

signed main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    
    int t = 1;
    cin >> t;

    while(t -- ){
        solve();
    }

    return 0;
}

詳細信息

Test #1:

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

input:

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

output:

A
A

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 10ms
memory: 3656kb

input:

1000
44
WaiooyIXa O accepted
WaiooyIXa P accepted
ZYYsNWag P accepted
DPIawQg D rejected
IzPdjnM Z rejected
Ra D rejected
kwQyGxLo I rejected
DPIawQg L accepted
kwQyGxLo I accepted
mmWxDuADCB D rejected
PXwVAOgwiz P rejected
ZYYsNWag U accepted
IzPdjnM Z accepted
TgBNO P rejected
kwQyGxLo J accepted...

output:

Z
P
Z
I
B
I
G
H
S
T
K
I
H
R
Z
L
W
O
I
P
P
B
I
B
A
O
A
Z
Q
O
S
O
R
Z
H
G
S
E
S
D
G
M
R
C
U
V
W
P
A
O
P
E
A
B
U
N
Q
T
L
O
V
A
Z
N
E
V
Q
J
B
G
O
O
E
M
A
U
L
A
K
W
J
S
E
W
Z
K
K
I
S
P
X
M
L
G
H
Y
J
P
T
J
O
P
X
N
C
V
Y
Z
S
Q
J
H
Q
T
O
C
E
P
U
V
I
U
E
I
P
K
I
R
X
N
R
N
O
Q
L
I
X
I
H
Z
J
Z
Y
K
G
F
V
N
B
X
...

result:

wrong answer 2nd lines differ - expected: 'E', found: 'P'