思路
关键点在任意时间内都通过率大于等于50%的题为签到题
这句话
每一次都进行判断是不是满足条件即可
代码
// Problem: 九峰与签到题 // Contest: NowCoder // URL: https://ac.nowcoder.com/acm/contest/9984/A // Memory Limit: 524288 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> using namespace std; #define pb push_back #define mp(aa,bb) make_pair(aa,bb) #define _for(i,b) for(int i=(0);i<(b);i++) #define rep(i,a,b) for(int i=(a);i<=(b);i++) #define per(i,b,a) for(int i=(b);i>=(a);i--) #define mst(abc,bca) memset(abc,bca,sizeof abc) #define X first #define Y second #define lowbit(a) (a&(-a)) #define debug(a) cout<<#a<<":"<<a<<"\n" typedef long long ll; typedef pair<int,int> pii; typedef unsigned long long ull; typedef long double ld; const int N=100010; const int INF=0x3f3f3f3f; const int mod=1e9+7; const double eps=1e-6; const double PI=acos(-1.0); int m,n; int sum[N],ac[N]; vector<int> ans; bool st[N]; void check(){ rep(id,1,n){ if(sum[id]){ if(2*ac[id]<sum[id]) st[id]=0; } } } void solve(){ cin>>m>>n; rep(id,1,n) st[id]=1; while(m--){ int id;string op; cin>>id>>op; sum[id]++; if(op=="AC") ac[id]++; check(); } rep(id,1,n){ if(sum[id]){ if(st[id]) ans.pb(id); } } if(!ans.size()) cout<<"-1\n"; else { for(int x:ans) cout<<x<<" "; } } int main(){ ios::sync_with_stdio(0);cin.tie(0); // int t;cin>>t;while(t--) solve(); return 0; }