QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#176339#5682. PSETyyc4591WA 0ms3572kbC++141.1kb2023-09-11 15:43:352023-09-11 15:43:35

Judging History

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

  • [2023-09-11 15:43:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3572kb
  • [2023-09-11 15:43:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	int n;
	cin >> n;
	vector<pair<string, string>>v;

	for (int i = 0; i < n; i++)
	{
		string s, t;
		cin >> s >> t;
		v.push_back({s, t});
	}

	auto check =[&](pair<string, string> a, pair<string, string>b,  pair<string, string> c)
	{	
		string aa, bb, cc;
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < 2; j++) {
				for (int k = 0; k < 2; k++) {
					if(i) 
					 	aa = a.first;
					 else
					 	aa = a.second;
					 if(j) 
					 	bb = a.first;
					 else
					 	bb = a.second;
					 if(k) 
					 	cc = a.first;
					 else
					 	cc = a.second;	

					 for (int i = 0; i < 4; i++)
					 {
					 	if( (aa[i] == bb[i] && bb[i] == cc[i]) || (aa[i] != bb[i] && aa[i] != cc[i] && bb[i] != cc[i]) )
					 		return 1;
					 }
				}
			}
		}

		return 0;
	};

	int ans = 0;
	for (int a = 0; a < n; a++) {
		for (int b = a + 1; b < n; b++) {
			for (int c = b + 1; c < n; c++) {
				if(check(v[a], v[b], v[c]))
					ans++;
			}
		}
	}

	cout << ans << "\n";

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

input:

4
3BFD 1RED
1GSA 3GSO
3REA 1BFO
2REO 2BFA

output:

4

result:

ok single line: '4'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3532kb

input:

7
3GED 1GFD
2RSD 2BSD
1BFA 3REO
2RED 2BFD
3GSD 1GSD
3BFO 1REA
2GEA 2GFO

output:

35

result:

wrong answer 1st lines differ - expected: '1', found: '35'