이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <bits/stdc++.h>
#include <map>
#include <vector>
#include <cmath>
#include <algorithm>
#include <unistd.h>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, int> pil;
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll,ll> pll;
const int SS = 1e5 + 8, MOD = 1e9 + 7;
class Solution{
public:
ll N, di, xi, DP[SS];
vector<pll> arr = {{-1, -1}};
ll helper(ll curr){
auto [diff, x] = arr[curr];
DP[curr] = 1;
if (diff == 0) return 1;
for (int child = diff + curr, t = 0; child <= N && t < x; child += diff, t++){
DP[curr] += helper(child);
}
return (DP[curr] %= MOD);
}
ll profitProfit(){
cin >> N;
fill(DP, DP + SS, -1);
for (int i = 0; i < N; i++){
cin >> di >> xi;
arr.push_back( make_pair(di, xi) );
}
return helper(1);
}
};
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
Solution p;
cout << p.profitProfit();
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In member function 'll Solution::helper(ll)':
Main.cpp:26:8: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
26 | auto [diff, x] = arr[curr];
| ^
# | 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... |