답안 #1084669

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084669 2024-09-06T16:27:25 Z SulA Calvinball championship (CEOI15_teams) C++17
30 / 100
1000 ms 1112 KB
#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

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()) {
      |         ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 436 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 903 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1061 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1032 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1067 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1039 ms 1112 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1018 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1020 ms 1112 KB Time limit exceeded
2 Halted 0 ms 0 KB -