QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#190215 | #3671. Email Destruction | triplem5ds# | WA | 1ms | 3560kb | C++23 | 1.6kb | 2023-09-28 15:16:55 | 2023-09-28 15:16:55 |
Judging History
answer
/// Msaa el 5ra
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll
using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;
const int N = 5e5 + 5, LG = 18, MOD = 1e9 + 7;
const long double PI = acos(-1);
const long double EPS = 1e-7;
void doWork() {
int n, k;
cin >> n >> k;
cin.ignore();
vector<string> vec;
f(i, 0, k) {
string s;
getline(cin, s);
vec.push_back(s);
}
sort(all(vec), [&](string a, string b) {
return a.size() < b.size();
});
set<string> st;
int cnt = 0;
f(i, 0, k) {
cnt += 1;
for (int j = 0; j < vec[i].size(); j++) {
if (j + 4 <= vec[i].size() && vec[i].substr(j, 4) == "Re: ") {
cnt += 1;
}
if (j > 4 && vec[i].substr(j - 4, 4) == "Re: " && st.count(vec[i].substr(j))) {
cnt -= 1;
}
}
st.insert(vec[i]);
}
if (cnt <= n)
cout << "YES\n";
else
cout << "NO\n";
}
int32_t main() {
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
int t = 1;
// cin >> t;
while (t--) {
doWork();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3532kb
input:
7 3 Re: Re: Re: hello Re: world hello
output:
YES
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
3 2 Re: Re: pleasehelp me
output:
NO
result:
ok answer is NO
Test #3:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
1 1 xohw
output:
YES
result:
ok answer is YES
Test #4:
score: 0
Accepted
time: 0ms
memory: 3460kb
input:
2 1 Re: Re: hrkqzcub
output:
NO
result:
ok answer is NO
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 3560kb
input:
2 2 cn Re: cn
output:
NO
result:
wrong answer expected YES, found NO