QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#698934 | #7076. Browser Games | kiwi | WA | 1ms | 6212kb | C++20 | 1.4kb | 2024-11-01 23:12:32 | 2024-11-01 23:12:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct node {
long long num;
string s;
long long res;
} web[50005];
bool cmp1(struct node x, struct node y) {
if (x.s < y.s) {
return true;
}
else {
return false;
}
}
bool cmp2(struct node x, struct node y) {
if (x.num < y.num) {
return true;
}
else {
return false;
}
}
int main() {
// ios::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
long long n;
cin >> n;
for (long long i = 1; i <= n; i++) {
string temp;
cin >> temp;
web[i].num = i;
web[i].s = temp;
}
if (web[1].s[0] == 'h')
{
cout << 1 << endl << 1 << endl << 1;
}
else
{
sort(web + 1, web + 1 + n, cmp1);
web[0].s = web[1].s, web[n + 1].s = web[n].s;
for (long long i = 1; i <= n; i++) {
long long tempa = 0, tempb = 0, tempc = 0, tempd = 0;
// cout << web[i - 1].s << " " << web[i].s << " " << web[i + 1].s << "\n";
for (long long j = 0; j < web[i].s.size(); j++) {
if (web[i].s[j] != web[i + 1].s[j] && tempc == 0) {
tempa = j;
tempc = 1;
}
if (web[i].s[j] != web[i - 1].s[j] && tempd == 0) {
tempb = j;
tempd = 1;
}
}
web[i].res = max(tempa + 1, tempb + 1);
}
sort(web + 1, web + 1 + n, cmp2);
for (long long i = 1; i <= n; i++) {
cout << web[i].res << "\n";
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5916kb
input:
3 ufoipv.ofu hsbocmvfgboubtz.kq hfotijo.njipzp.dpn/kb
output:
1 2 2
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 6212kb
input:
3 hfotijo.njipzp.dpn/kb hsbocmvfgboubtz.kq ufoipv.ofu
output:
1 1 1
result:
wrong answer 3rd lines differ - expected: '2', found: '1'