답안 #34376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
34376 2017-11-10T18:56:14 Z imaxblue File Paths (BOI15_fil) C++14
0 / 100
3 ms 3196 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()

int n, m, k, t, a, b;
vector<pii> v[3005];
vector<ll> s;
bool p[1000005], u[3005];
void dfs2(int N, ll D){
    return;
    fox(l, v[N].size()){
        dfs2(v[N][l].x, D+v[N][l].y);
    }
    if (N<=n && D+t<=k){
        p[D+t]=1;
        //cout << D+t << endl;
    }
}
void dfs(int N, ll D){
    if (N>n){
        //cout << N << ' ' << D << endl;
        //fox(l, s.size()) cout << s[l] << ' '; cout << endl;
        if (D==k){
            u[N-n]=1;
            return;
        }
        fox(l, s.size()){
            if (D-s[l]<=k && p[D-s[l]]){
                u[N-n]=1;
                continue;
            }
        }
    }
    s.pb(D);
    fox(l, v[N].size()){
        dfs(v[N][l].x, D+v[N][l].y);
    }
    s.pop_back();
}
int main(){
    cin >> n >> m >> k >> t;
    ++t;
    fox1(l, n){
        cin >> a >> b;
        v[a].pb(mp(l, b+1));
    }
    fox1(l, m){
        cin >> a >> b;
        v[a].pb(mp(l+n, b+1));
    }
    dfs2(0, 0);
    //dfs(0, 0);
    fox1(l, m){
        if (u[l]) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

Compilation message

fil.cpp: In function 'void dfs2(int, long long int)':
fil.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
fil.cpp:33:5: note: in expansion of macro 'fox'
     fox(l, v[N].size()){
     ^
fil.cpp: In function 'void dfs(int, long long int)':
fil.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
fil.cpp:49:9: note: in expansion of macro 'fox'
         fox(l, s.size()){
         ^
fil.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fox(k, x) for (int k=0; k<x; ++k)
                                  ^
fil.cpp:57:5: note: in expansion of macro 'fox'
     fox(l, v[N].size()){
     ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 3196 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3064 KB Output isn't correct
2 Halted 0 ms 0 KB -