이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
map<string,int> mg,md,ml,mp;
set<string> se;
long long w,n;
string s;
char pg,pd,lg,ld;
bool czy_pozioma_os_symetrii(string karta){
// string karta = ""s + pg+lg+pd+ld;
return (karta[0] == karta[2] && karta[1]==karta[3]);
}
bool czy_pionowa_os_symetrii(string karta){
// string karta = ""s + pg+lg+pd+ld;
return (karta[0] == karta[1] && karta[2]==karta[3]);
}
bool symetria_osiowa(string karta){
// string karta = ""s + pg+lg+pd+ld;
return karta[0] == karta[3] && karta[1]==karta[2];
}
string lusterko_pionowo(string karta){
return ""s + karta[1]+karta[0]+karta[3]+karta[2];
}
string lusterko_poziomo(string karta){
// string karta = ""s + pg+lg+pd+ld;
return ""s + karta[2]+karta[3]+karta[0]+karta[1];
}
int main(){
iostream::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int t = 0;t < n;t++){
cin >> lg >> pg >> ld >> pd;
string karta = ""s + pg+lg+pd+ld;
mg[""s + lg + pg]++;
md[""s + ld + pd]++;
ml[""s + lg + ld]++;
mp[""s + pg + pd]++;
if(czy_pozioma_os_symetrii(karta)) w--;
if(czy_pionowa_os_symetrii(karta)) w--;
if(symetria_osiowa(karta)){
if(se.count(lusterko_pionowo(karta))) w-=3;
} else {
if(se.count(lusterko_pionowo(karta))) w--;
if(se.count(lusterko_poziomo(karta))) w--;
}
se.insert(karta);
//cout << "wczesniej : " << w << "\n";
}
//cout << "g\n";
for(auto e : md){
s=e.first;
w+=e.second*mg[s];
//cout << w << " : " << e.first << " : " << e.second << " : " << odwroc(s) << " : " << mg[odwroc(s)] << "\n";
}
//cout << "p\n";
for(auto e : mp){
s=e.first;
w+=e.second*ml[s];
//cout << w << " : " << e.first << " : " << e.second << " : " << odwroc(s) << " : " << ml[odwroc(s)] << "\n";
}
//cout << "odp: ";
cout << w;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |