이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FORI(i, n) for(ll i = 0; i < n; i++)
#define FOR(i, n) for(ll i = 1; i <= n; i++)
typedef vector < ll > vl;
typedef set < ll > setl;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define pll pair<ll, ll>
#define db double
#define nll cout << "\n"
#define nl "\n"
#define sync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
const ll mod = 1000007;
const int MAX = 300000 + 5;
const int imax = 2147483647;
ll n, m, k, res, rnk[MAX];
ll a[MAX];
ll cnt, ans;
vl v, cur;
void f (ll ind, ll mx){
if(ind > n){
cnt++;
cnt %= mod;
if(cur == v){
cout << cnt;
}
return;
}
FOR(i, min(ind, mx + 1)){
cur.push_back(i);
f(ind + 1, max(mx, i));
cur.pop_back();
}
}
void solve(){
cin >> n;
ll res = 0;
for(ll i = n; i >= 1; i--)cin >> a[i], v.push_back(a[i]);
f(1, 1);
}
signed main(){
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
sync;
ll t = 1;
// cin >> t;
FOR(i, t){
// cout << "Case #" << i << ": ";
solve();
}
}
컴파일 시 표준 에러 (stderr) 메시지
teams.cpp: In function 'void solve()':
teams.cpp:42:8: warning: unused variable 'res' [-Wunused-variable]
42 | ll res = 0;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |