diff options
Diffstat (limited to 'contests/filtrationContest/C')
| -rwxr-xr-x | contests/filtrationContest/C/main | bin | 22528 -> 50432 bytes | |||
| -rw-r--r-- | contests/filtrationContest/C/main.cpp | 26 |
2 files changed, 11 insertions, 15 deletions
diff --git a/contests/filtrationContest/C/main b/contests/filtrationContest/C/main Binary files differindex 4fad05f..b207653 100755 --- a/contests/filtrationContest/C/main +++ b/contests/filtrationContest/C/main diff --git a/contests/filtrationContest/C/main.cpp b/contests/filtrationContest/C/main.cpp index 0d06899..e3ed80c 100644 --- a/contests/filtrationContest/C/main.cpp +++ b/contests/filtrationContest/C/main.cpp @@ -1,23 +1,19 @@ #include<bits/stdc++.h> - + using namespace std; - -int64_t fq[22]; - + int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); + ios_base::sync_with_stdio(false); + cin.tie(NULL); long long n; cin >> n; - for (int i = 1; i <= n; i++) { - int64_t x; + long long ans = 0; + map<long long, long long> fq; + for(int i = 0; i < n; i++) { + long long x; cin >> x; - fq[10 + x]++; + ans += fq[x]; + fq[-x]++; } - int64_t ans = 0; - for (int i = 1;i <= 10; i++) { - ans += fq[10 - i] * fq[10 + i]; - } - ans += fq[10] * (fq[10] - 1) / 2; - cout << ans; + cout << ans << '\n'; } |
