Submission #628207

#TimeUsernameProblemLanguageResultExecution timeMemory
628207catalystgmaW (RMI18_w)C++11
20 / 100
179 ms16416 KiB
#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 (stderr)

w.cpp: In function 'int main()':
w.cpp:35:10: warning: unused variable 'j' [-Wunused-variable]
   35 |   int i, j, z;
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...