Submission #1121836

#TimeUsernameProblemLanguageResultExecution timeMemory
1121836vjudge1Calvinball championship (CEOI15_teams)C++14
20 / 100
1065 ms1360 KiB
//#pragma GCC optimize ("O1") #include <bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define F first #define S second #define ll long long #define int ll #define pii pair<int, int> #define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define M_PI 3.14159265358979323846 #define all(v) v.begin(), v.end() #define pss pair<string, string> #define no cout<<"NO"<<endl; #define yes cout<<"YES"<<endl; #define imp cout<<-1<<endl; #define flu cout.flush(); #define Endl endl const int N = 300009; const int mod = 1e6+7; int n, cnt=0; vector<int>a; vector<int>ans; void f(int n, int q, int maks){ if(q==n+1){ cnt++; if(a==ans){ cout<<cnt<<endl; return; } return; } for(int i=1; i<=min(q, maks+1); i++){ ans.pb(i); f(n, q+1, max(maks, i)); ans.pop_back(); } } void solve(){ cin>>n; for(int i=0; i<n; i++){ int x; cin>>x; a.pb(x); } f(n, 1, 1); } signed main(){ io; int t=1; //cin>>t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...