QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#579236#9320. Find the Easiest Problemlmeowdn#TL 0ms3624kbC++141.8kb2024-09-21 10:52:512024-09-21 10:52:51

Judging History

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

  • [2024-09-21 10:52:51]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3624kb
  • [2024-09-21 10:52:51]
  • 提交

answer

//Shirasu Azusa 2024.09
#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x)  {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x)  {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x)  {return (x==0?-1:__builtin_ctzll(x));}

#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} 
  return x*w;    
}

signed main() {
  ios::sync_with_stdio(0);
  int T=read();
  while(T--) {
    map<pair<string,string>,int> ac;
    map<string,int> f;
    int n=read();
    while(n--) {
      string a,b,c; cin>>a>>b>>c;
      if(c=="accepted"&&!ac[make_pair(a,b)]) {
        f[b]++;
        ac[make_pair(a,b)]=1;
      }
    }
    int res=0; string ans="A";
    for(auto [x,y]:f) {
      if(y>res||(y==res&&x<ans)) ans=x, res=y;
    }
    cout<<ans<<'\n';
  }
  return 0;
}

详细

Test #1:

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

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
Time Limit Exceeded

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:

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

result: