QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#576111#9320. Find the Easiest ProblemdaringWA 178ms60968kbJava82.7kb2024-09-19 18:28:532024-09-19 18:28:53

Judging History

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

  • [2024-09-19 18:28:53]
  • 评测
  • 测评结果:WA
  • 用时:178ms
  • 内存:60968kb
  • [2024-09-19 18:28:53]
  • 提交

answer



import java.io.*;

import java.util.*;


public class Main {

    private static void solve() {
        int n=sc.nextInt();
        Map<Character,Set<String>>map=new HashMap<>();
        while (n-->0){
            String a=sc.next();
            char b=sc.next().charAt(0);
            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;
        Character s=' ';
        for (Map.Entry<Character, 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: 43ms
memory: 37108kb

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: 178ms
memory: 60968kb

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'