QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#723945#5681. Caravan Trip PlansBackToSquare1WA 0ms3664kbC++201.3kb2024-11-08 04:20:022024-11-08 04:20:02

Judging History

你现在查看的是最新测评结果

  • [2024-11-08 04:20:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3664kb
  • [2024-11-08 04:20:02]
  • 提交

answer

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, ll> pl;
typedef pair<ld,ld> pd;
typedef vector<ll> vl;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
 
#define G(x) ll x; cin >> x;
#define F(i, l, r) for (ll i = l; i < (r); ++i)
#define all(a) begin(a), end(a)
#define K first
#define V second
#define OK(i,j) i >= 0 && i < n && j >= 0 && j < m
 
#define NN 2505
#define MM 5005
#define MOD 1000007

ll dp[65][65];
bool oasis[65];

void solve() {

    ll N, M;
    cin >> N >> M;
    ll oasis_camps[N];
    oasis[0] = 1;
    for(ll i=0;i<N;i++) {
        cin >> oasis_camps[i];
        oasis[oasis_camps[i]] = 1;
    }

    dp[0][0] = 1;
    for(ll i=0;i<65;i++) {
        for(ll j=1;j<65;j++) {
            if(oasis[i]) dp[i][j] += dp[i][j-1];
            dp[i][j] += dp[i-1][j-1];
        }
    }

    ll d, t;
    for(ll i=0;i<M;i++) {
        cin >> d >> t;
        cout << dp[oasis_camps[d-1]][t] << '\n';
    }


}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cout << fixed << setprecision(10);

    solve();

    return 0;

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

input:

5 1
2 3 5 7 11
3 7

output:

10

result:

ok single line: '10'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

8 3
2 3 5 7 11 13 17 19
3 7
5 15
8 24

output:

10
126
1287

result:

ok 3 lines

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3588kb

input:

15 5
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47
7 23
10 35
4 14
5 23
15 56

output:

1716
8008
338
19895050523703004
1650879676350032

result:

wrong answer 3rd lines differ - expected: '330', found: '338'