답안 #99669

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99669 2019-03-06T05:03:38 Z adlet Calvinball championship (CEOI15_teams) C++17
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>

#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define ios ios_base::sync_with_stdio(0), cin.tie(0)

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
const int mod = 1e6 + 7;
const int INF = 1e9;
const double PI = acos(-1.0);

vector < int > vec;

int n, a[20], cnt;

ll res = 1;

void rec(int i, int mx = 1) {
    if (i == n + 1) {
        ++cnt;
        if (cnt >= mod)
            cnt -= mod;
//        for (int i : vec)
//            cout << i << " ";
//        cout << "\n";
        for (int i = 0; i < vec.size(); ++i) {
            if (vec[i] != a[i + 1])
                return;
        }
        cout << cnt;
        exit(0);
    }
    for (int j = 1; j <= min(i, mx + 1); ++j) {
        vec.push_back(j);
        rec(i + 1, max(j, mx));
        vec.pop_back();
    }

}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", a + i);
        res = (res * 1ll * a[i]) % mod;
    }
    cout << res;
}
/**
clock() / (double)CLOCKS_PER_SEC < 1.9

*/

Compilation message

teams.cpp: In function 'void rec(int, int)':
teams.cpp:29:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < vec.size(); ++i) {
                         ~~^~~~~~~~~~~~
teams.cpp: In function 'int main()':
teams.cpp:45:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
teams.cpp:47:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", a + i);
         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -