QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#698934#7076. Browser GameskiwiWA 1ms6212kbC++201.4kb2024-11-01 23:12:322024-11-01 23:12:33

Judging History

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

  • [2024-11-01 23:12:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6212kb
  • [2024-11-01 23:12:32]
  • 提交

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;
}

詳細信息

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'