Submission #1084669

#TimeUsernameProblemLanguageResultExecution timeMemory
1084669SulACalvinball championship (CEOI15_teams)C++17
30 / 100
1080 ms1112 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e6 + 7; vector<int> a; int cnt = 0; void backtrack(int i = 0, int mx = 0, bool eq = true) { if (i == a.size()) { (cnt += 1) %= MOD; if (eq) { cout << cnt; exit(0); } return; } for (int val = 1; val <= mx + 1; val++) { backtrack(i + 1, max(mx, val), eq && val == a[i]); } } int main() { int n; cin >> n; a.resize(n); for (int& x : a) cin >> x; backtrack(); }

Compilation message (stderr)

teams.cpp: In function 'void backtrack(int, int, bool)':
teams.cpp:9:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     if (i == a.size()) {
      |         ~~^~~~~~~~~~~
#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...