# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404291 | 2021-05-14T06:35:34 Z | idas | Cards (LMIO19_korteles) | C++11 | 121 ms | 3080 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; 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]++; } 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++; } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 300 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 121 ms | 3080 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 21 ms | 720 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 300 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |