# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290882 | 2020-09-04T14:16:51 Z | crossing0ver | W (RMI18_w) | C++17 | 78 ms | 5404 KB |
#include<bits/stdc++.h> #define ll long long #define pb push_back #define pii pair<int,int> #define vi vector<int> #define fi first #define se second #define all(x) (x).begin(),(x).end() using namespace std; int cnt[1000005],arr[300005]; main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 0; i< n; i++) { cin >> arr[i]; cnt[arr[i]]++; } sort(arr,arr+n); reverse(arr,arr+n); if (arr[n-1] == arr[0]) { cout << 0; return 0; } for (int i = 1; i <= n; i++) { if (arr[i] != arr[i-1]) { ll left = i; ll right = n - left; if (left < 3 || right < 2) { cout << 0; return 0; } ll ans = 0; for (int i = 1; i <= left - 2; i++) ans += (left - i - 1); ans *= right - 1; cout << ans%(1000000007); return 0; } } int a[2] = {}; int c= 0; ll ans = 1; for (int i = 1; i <= 1000000; i++) { if (cnt[i]) { c++; ans*=(cnt[i] - 1); } } cout << ans*(c/2); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 7 ms | 640 KB | Output is correct |
4 | Correct | 28 ms | 1528 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Incorrect | 1 ms | 384 KB | Output isn't correct |
3 | Incorrect | 11 ms | 4352 KB | Output isn't correct |
4 | Incorrect | 27 ms | 4708 KB | Output isn't correct |
5 | Incorrect | 42 ms | 3092 KB | Output isn't correct |
6 | Incorrect | 78 ms | 5404 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Incorrect | 1 ms | 384 KB | Output isn't correct |
3 | Incorrect | 0 ms | 384 KB | Output isn't correct |
4 | Incorrect | 1 ms | 384 KB | Output isn't correct |
5 | Incorrect | 1 ms | 384 KB | Output isn't correct |
6 | Incorrect | 1 ms | 384 KB | Output isn't correct |
7 | Incorrect | 2 ms | 768 KB | Output isn't correct |
8 | Incorrect | 16 ms | 1152 KB | Output isn't correct |
9 | Incorrect | 30 ms | 1152 KB | Output isn't correct |
10 | Incorrect | 74 ms | 5368 KB | Output isn't correct |