제출 #588205

#제출 시각아이디문제언어결과실행 시간메모리
588205koloCards (LMIO19_korteles)C++14
0 / 100
1090 ms32900 KiB
#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]; } string odwroc(string s){ for(int i = 0;i < s.size()/2;i++) swap(s[i],s[s.size()-i-1]); return s; } 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[odwroc(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[odwroc(s)]; //cout << w << " : " << e.first << " : " << e.second << " : " << odwroc(s) << " : " << ml[odwroc(s)] << "\n"; } //cout << "odp: "; cout << w; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

korteles.cpp: In function 'std::string odwroc(std::string)':
korteles.cpp:32:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i = 0;i < s.size()/2;i++)
      |                   ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...