# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
595522 | AdamGS | Cards (LMIO19_korteles) | C++17 | 50 ms | 6604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
ll ile1[26][26][4], ile2[26][26][4], ile[26][26][26][26], ans;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
while(n--) {
char c1, c2, c3, c4;
cin >> c1 >> c2 >> c3 >> c4;
int a=c1-'A', b=c2-'A', c=c4-'A', d=c3-'A';
ans+=ile1[a][b][2]+ile1[d][c][0]+ile1[a][d][1]+ile1[b][c][3];
ans-=ile[d][c][b][a]+ile[b][a][d][c];
if(a==c) ans-=ile2[a][b][0]+ile2[c][d][2];
if(b==d) ans-=ile2[b][c][1]+ile2[d][a][3];
if(a==c && b==d) ans+=3*ile[b][a][b][a];
++ile1[a][b][0]; ++ile1[d][c][2]; ++ile1[a][d][3]; ++ile1[b][c][1];
++ile[a][b][c][d];
if(a==c) {
++ile2[d][a][0];
++ile2[b][a][2];
}
if(b==d) {
++ile2[a][b][1];
# | 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... |