QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#261727 | #7700. Split Decisions | WA_automaton | WA | 64ms | 3688kb | C++17 | 2.1kb | 2023-11-23 09:33:38 | 2023-11-23 09:33:39 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
void debug() {std::cerr << "\n";}
template<class T, class... OtherArgs>
void debug(T &&var, OtherArgs &&... args) {
std::cerr << std::forward<T>(var) << " ";
debug(std::forward<OtherArgs>(args)...);
}
#define SZ(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const int N = 2010, M = 10000010;
const int P = 998244353;
LL powmod(LL a, LL b, LL p = P) {LL res = 1 % p; a %= p; assert(b >= 0); for(; b; b >>= 1) { if (b & 1) res = res * a % p; a = a * a % p; } return res; }
int n, m;
void solve() {
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
int ans = 0;
for (int l = 0; l < 18; l++) {
vector<vector<string>> mp;
map<string, int> id;
for (int i = 0; i < n; i++) {
if (l + 1 >= s[i].size()) continue;
string t = s[i].substr(0, l) + s[i].substr(l + 2);
if (!id.count(s[i].substr(l, 2))) mp.pb({}), mp.back().pb(t), id[s[i].substr(l, 2)] = mp.size() - 1;
else mp[id[s[i].substr(l, 2)]].pb(t);
}
for (int i = 0; i < mp.size(); i++) {
set<string> has;
for (int j = i + 1; j < mp.size(); j++) {
for (auto st : mp[j]) {
has.insert(st);
}
int c = 0;
for (auto st : mp[i]) {
c += has.count(st);
if (c > 1) {
break;
}
}
// if (c == 1) debug(l, i, j);
ans += c == 1;
}
}
}
cout << ans << '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(20);
int _ = 1;
// cin >> _;
while (_--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3496kb
input:
5 CELL GULL GUSH HALL HASH
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 64ms
memory: 3688kb
input:
1000 ABSALOM ACRATIA AKHOOND ALIBAMU AMUSIVE AGONIZE ACOCOTL ACTINON ABELITE ADVISAL ALBETAD AMAKEBE ANASAZI AMUCHCO ADDENDA AMESITE ALIENEE ADRENIN ACERATE AKERITE AMPELIS ABABDEH ALCIDAE AGRANIA ALASTER AMERISM AMILOUN AMYGDAL ALUNDUM ACHOLIC ALTHAEA ACIDIFY AMNESTY ABBOTCY AMBALAM AMENITY AEOLISM...
output:
17531
result:
wrong answer 1st lines differ - expected: '621', found: '17531'