Submission #1121742

#TimeUsernameProblemLanguageResultExecution timeMemory
1121742rahidilbayramliCalvinball championship (CEOI15_teams)C++17
10 / 100
67 ms65536 KiB
#pragma GCC optimize("-O3") #include<bits/stdc++.h> #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define sz(v) (ll)(v.size()) #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; const ll mod = 1e6+7; void solve() { ll n, i, j, k, l, r, f, p; cin >> n; ll a[n+5], cnt = 0; for(i = 1; i <= n; i++){ cin >> a[i]; if(a[i] == i) cnt++; } vector<vl>vect; vl v; for(i = 1; i <= n; i++) v.pb(1); ll pos = n - 1, pos2 = n - 1; vect.pb(v); while(true) { while(pos2 && v[pos2]-v[pos2-1] == 1) { pos2--; } v[pos2]++; k = v[pos2]; for(j = pos2+1; j < n; j++) { k--; v[j] = max(1LL, k); } pos2 = n - 1; if(v[0] > 1) break; vect.pb(v); } bool ok = true; cnt = 0; for(auto u : vect) { cnt++; ok = true; for(j = 0; j < n; j++) { if(u[j] == a[j+1]) continue; ok = false; } if(ok) { cout << cnt % mod << "\n"; return; } } } int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll tests = 1; //cin >> tests; while(tests--) { solve(); } }

Compilation message (stderr)

teams.cpp: In function 'void solve()':
teams.cpp:19:20: warning: unused variable 'l' [-Wunused-variable]
   19 |     ll n, i, j, k, l, r, f, p;
      |                    ^
teams.cpp:19:23: warning: unused variable 'r' [-Wunused-variable]
   19 |     ll n, i, j, k, l, r, f, p;
      |                       ^
teams.cpp:11:11: warning: unused variable 'first' [-Wunused-variable]
   11 | #define f first
      |           ^~~~~
teams.cpp:19:26: note: in expansion of macro 'f'
   19 |     ll n, i, j, k, l, r, f, p;
      |                          ^
teams.cpp:19:29: warning: unused variable 'p' [-Wunused-variable]
   19 |     ll n, i, j, k, l, r, f, p;
      |                             ^
teams.cpp:31:8: warning: unused variable 'pos' [-Wunused-variable]
   31 |     ll pos = n - 1, pos2 = n - 1;
      |        ^~~
#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...