#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define s second
#define f first
vector<char> find(vector<char> v){
vector<char> k(4,' ');
k[3-1] = v[1]; k[4-1] = v[2];
k[0] = v[3]; k[2-1] = v[4];
if(k[0] == v[2] && k[2] == v[4] && k[1] == v[1] && k[3] == v[3]) return k;
return {};
}
bool check(vector<char> a, vector<char> b){
if(a[1] == b[3] && a[2] == b[4]) return true;
if(a[1] == b[2] && a[3] == b[4]) return true;
if(a[2] == b[1] && a[4] == b[3]) return true;
if(a[3] == b[1] && a[4] == b[2]) return true;
return false;
}
signed main(){
int n; cin>>n;
map<pair<char,char>,int> m12,m13,m34,m24;
map<vector<char>,int> m1234,m123, m124, m134, m234;
int ans = 0;
vector<vector<char>> v;
for(int i = 0; i<n; i++){
// 100% CHECKED
vector<char> v1(5); cin>>v1[1]>>v1[2]>>v1[3]>>v1[4];
v.push_back(v1);
}
for(int i = 0; i<n; i++){
for(int j = i+1; j<n; j++){
if(check(v[i],v[j])) ans++;
}
}
cout<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
5 ms |
476 KB |
Output is correct |
7 |
Correct |
38 ms |
512 KB |
Output is correct |
8 |
Correct |
81 ms |
604 KB |
Output is correct |
9 |
Correct |
97 ms |
604 KB |
Output is correct |
10 |
Correct |
99 ms |
580 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1016 ms |
25768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Execution timed out |
1055 ms |
3088 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
5 ms |
476 KB |
Output is correct |
3 |
Correct |
38 ms |
512 KB |
Output is correct |
4 |
Correct |
81 ms |
604 KB |
Output is correct |
5 |
Correct |
97 ms |
604 KB |
Output is correct |
6 |
Correct |
99 ms |
580 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Execution timed out |
1016 ms |
25768 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |