Submission #1294245

#TimeUsernameProblemLanguageResultExecution timeMemory
1294245salehhasanliKangaroo (CEOI16_kangaroo)C++20
0 / 100
1 ms560 KiB
#include <bits/stdc++.h> using namespace std; // #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") // #pragma GCC optimize("unroll-loops") #define ll long long #define int128 __int128_t #define pii pair<int, int> #define int long long #define pb push_back #define F first #define S second #define all(v) (v).begin(), (v).end() #define rall(v) (v).begin(), (v).end() #define MOD (ll)1e9 + 7 #define INF (ll)1e18 #define RINF (ll)-1e18 void cinv(vector<int>&a,int n){ for (int i = 0; i < n;i++){ cin >> a[i]; } } void coutv(vector<int>&a,int n){ for (int i = 0; i < n;i++){ cout<< a[i]<<" "; } } void solve(){ int n, a, b; cin >> n >> a >> b; vector<int> c; for (int i = 1; i <= n;i++){ if(i!=a && i!=b) c.push_back(i); } vector<int> d(n + 1, 1); int r = 0; for (int i = 0; i < c.size(); i++) { long long q = c.size() - i - 1; long long w = i; long long h = 1; if (c[i] > a) { h = (h*w); } else { h = (h*q); } if (c[i] > b) { h = (h*w); } else { h = (h*q); } if(q>1){ h = (h*q * (q - 1)*(c.size()-2)); } if(w>1){ h = (h*w * (w - 1)*(c.size()-2)); } r += h; // cout << h << endl; } cout << r << endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; // cin >> t; while(t--){ solve(); } } // 5 2 3 // 2 // 1 - 2. 4 - 1. 5 - 2 // 1 - 2 4 - 0 5 - 2 // 1 - 2 4 - 1 5 - 2 // 3 // 32
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...