QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#574320#9320. Find the Easiest ProblemdaringWA 223ms72540kbJava112.6kb2024-09-18 21:32:372024-09-18 21:32:39

Judging History

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

  • [2024-09-18 21:32:39]
  • 评测
  • 测评结果:WA
  • 用时:223ms
  • 内存:72540kb
  • [2024-09-18 21:32:37]
  • 提交

answer



import java.io.*;

import java.util.*;


public class Main {

    private static void solve() {
        int n=sc.nextInt();
        Map<String,Set<String>>map=new HashMap<>();
        while (n-->0){
            String a=sc.next();
            String b=sc.next();
            String c=sc.next();
            if(c.equals("accepted")){
                if(map.get(b)!=null){
                    map.get(b).add(a);
                }else {
                    Set<String> set = new HashSet<>();
                    set.add(a);
                    map.put(b,set);
                }
            }
        }
        int mx=0;
        String s="";
        for (Map.Entry<String, Set<String>> setEntry : map.entrySet()) {
            if(setEntry.getValue().size()>mx){
                mx= setEntry.getValue().size();
                s=setEntry.getKey();
            }
        }
        out.println(s);
    }


    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            solve();
        }
    out.flush();
        out.close();
    }


    static Kattio sc = new Kattio();
    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    static class Kattio {
        static BufferedReader r;
        static StringTokenizer st;

        public Kattio() {
            r = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            try {
                while (st == null || !st.hasMoreTokens()) {
                    st = new StringTokenizer(r.readLine());
                }
                return st.nextToken();
            } catch (Exception e) {
                return null;
            }
        }

        public int nextInt() {
            char[] str = next().toCharArray();
            int i = 0;
            boolean neg = false;
            if (str[0] == '-') {
                i = 1;
                neg = true;
            }
            int ans = 0;
            for (; i < str.length; i++) ans = ans * 10 + (str[i] - '0');
            return neg ? -ans : ans;
        }

        public long nextLong() {
            char[] str = next().toCharArray();
            int i = 0;
            boolean neg = false;
            if (str[0] == '-') {
                i = 1;
                neg = true;
            }
            long ans = 0;
            for (; i < str.length; i++) ans = ans * 10 + (str[i] - '0');
            return neg ? -ans : ans;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 48ms
memory: 48900kb

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: 223ms
memory: 72540kb

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
K
J
I
H
R
Z
C
K
O
Q
P
A
B
I
A
A
N
A
B
Q
O
F
O
R
T
H
G
K
E
S
D
F
D
R
C
U
V
W
P
A
O
P
E
A
B
U
M
C
T
L
G
V
A
Z
N
E
O
Q
F
B
G
J
I
E
M
A
A
S
A
K
W
J
S
E
W
Z
K
F
I
S
P
M
Q
G
G
H
W
I
P
T
D
O
A
F
N
C
S
Y
Z
S
G
J
F
Q
F
O
C
B
B
U
C
I
A
E
I
P
K
C
R
X
V
D
N
L
Q
L
I
X
I
H
U
J
Z
D
K
G
F
T
F
B
R
...

result:

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