Submission #628207

# Submission time Handle Problem Language Result Execution time Memory
628207 2022-08-13T08:09:50 Z catalystgma W (RMI18_w) C++11
20 / 100
179 ms 16416 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<61)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sz(a) ((int)(a).size())
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) std::cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) std::cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)std::cerr<<x[_]<<' ';std::cerr<<'\n',aaa
#define dbgs(x) std::cerr<<(#x)<<"[stl]: ";for(auto _:x)std::cerr<<_<<' ';std::cerr<<'\n',aaa
#define dbgp(x) std::cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa
#define dbgsp(x) std::cerr<<(#x)<<"[stl pair]:\n";for(auto _:x)std::cerr<<_.fi<<' '<<_.se<<'\n';aaa

using namespace std;

const int mod = 1000000007;
map<int, int> fv;

int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

  int n; cin >> n;

  int i, j, z;

  for (i = 1; i <= n; i++) {
    cin >> z;
    fv[z]++;
  }

  if (sz(fv) != 2) {
    cout << 0;
    return 0;
  }

  vi fvs;
  for (auto &x: fv) {
    fvs.pb(x.se);
  }

  cout << (ll)(fvs.back()-1) * (fvs.back()-2) % mod * 500000004 % mod * (fvs[0] - 1) % mod;

  return 0;
}

Compilation message

w.cpp: In function 'int main()':
w.cpp:35:10: warning: unused variable 'j' [-Wunused-variable]
   35 |   int i, j, z;
      |          ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 5 ms 560 KB Output is correct
4 Correct 19 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 340 KB Output isn't correct
3 Incorrect 10 ms 1936 KB Output isn't correct
4 Incorrect 39 ms 5596 KB Output isn't correct
5 Incorrect 110 ms 11084 KB Output isn't correct
6 Incorrect 169 ms 16416 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Incorrect 1 ms 324 KB Output isn't correct
5 Incorrect 1 ms 336 KB Output isn't correct
6 Incorrect 2 ms 468 KB Output isn't correct
7 Incorrect 3 ms 596 KB Output isn't correct
8 Incorrect 13 ms 956 KB Output isn't correct
9 Incorrect 30 ms 1248 KB Output isn't correct
10 Incorrect 179 ms 15936 KB Output isn't correct