# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
404296 | 2021-05-14T07:08:40 Z | idas | Cards (LMIO19_korteles) | C++11 | 193 ms | 2844 KB |
#include <bits/stdc++.h> #define FOR(i, begin, end) for(int i = (begin); i < (end); i++) #define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr) #define F first #define S second #define PB push_back #define MP make_pair #define SZ(x) ((int)((x).size())) #define LE(vec) vec[vec.size()-1] #define TSTS int t; cin >> t; while(t--)solve() const int INF = 1e9; const long long LINF = 1e18; const long double PI = asin(1)*2; const int MOD = 1e9+7; using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef map<int, int> mii; typedef long long ll; typedef long double ld; void setIO() { FAST_IO; } void setIO (string s) { setIO(); freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } unordered_map<string, int> up, down, lefts, rights; map<pii, bool> used; int main() { setIO(); int n; cin >> n; FOR(i, 0, n) { string a, b; cin >> a >> b; up[a]++; down[b]++; string lft = "", rt = ""; lft += a[0]; lft += b[0]; rt += a[1]; rt += b[1]; lefts[lft]++; rights[rt]++; } ll ans = 0; int in1 = 0, in2 = 0; for(auto[x, y] : up) { in2 = 0; for(auto[z, w] : down) { if(x == z && in1!=in2 && !used.count(MP(in1, in2))) { ans += y*w; used[MP(in1, in2)] = true; used[MP(in2, in1)] = true; } in2++; } in1++; } in1 = 0; for(auto[x, y] : lefts) { in2 = 0; for(auto[z, w] : rights) { if(x == z && in1!=in2 && !used.count(MP(in1, in2))) { ans += y*w; used[MP(in1, in2)] = true; used[MP(in2, in1)] = true; } in2++; } in1++; } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 193 ms | 2844 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 39 ms | 932 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |