# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198430 | 2020-01-26T02:53:53 Z | model_code | W (RMI18_w) | C | 59 ms | 504 KB |
/** * Method: Handles the case of exactly two distinct values. * * Author: Catalin Francu **/ #include <stdio.h> #define MOD 1000000007 int main() { int n, x; int v1, v2 = 0, c1 = 1, c2 = 0; scanf("%d %d", &n, &v1); while (--n) { scanf("%d", &x); if (x == v1) { c1++; } else { v2 = x; c2++; } } if (v1 > v2) { int tmp = c1; c1 = c2; c2 = tmp; } /** * Now we know that the smaller value occurs c1 times and the larger value * occurs c2 times. **/ int sol = (long long)(c1 - 1) * (c2 - 1) * (c2 - 2) / 2 % MOD; printf("%d\n", sol); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 14 ms | 380 KB | Output is correct |
4 | Correct | 43 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Incorrect | 5 ms | 256 KB | Output isn't correct |
3 | Incorrect | 10 ms | 256 KB | Output isn't correct |
4 | Incorrect | 21 ms | 256 KB | Output isn't correct |
5 | Incorrect | 41 ms | 256 KB | Output isn't correct |
6 | Incorrect | 59 ms | 376 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Output isn't correct |
2 | Incorrect | 5 ms | 256 KB | Output isn't correct |
3 | Incorrect | 5 ms | 256 KB | Output isn't correct |
4 | Incorrect | 5 ms | 376 KB | Output isn't correct |
5 | Incorrect | 5 ms | 256 KB | Output isn't correct |
6 | Incorrect | 6 ms | 256 KB | Output isn't correct |
7 | Incorrect | 6 ms | 376 KB | Output isn't correct |
8 | Incorrect | 21 ms | 256 KB | Output isn't correct |
9 | Incorrect | 31 ms | 256 KB | Output isn't correct |
10 | Incorrect | 56 ms | 256 KB | Output isn't correct |