發表文章

目前顯示的是 2018的文章

[TIOJ]1604. 蚯蚓之寄生蟲問題

題目連結: http://tioj.ck.tp.edu.tw/problems/1604 把時間排序然後dp。 # include < iostream > # include < algorithm > # include < cmath > # include < bitset > # include < queue > # include < vector > # define lld long long # define PB push_back # define F first # define S second # define jizz cin.tie(0);ios_base::sync_with_stdio(0); # define endl '\n' using namespace std; struct Node{ lld id,st,w; bool operator<(const Node &x)const{ return w < x.w; } }; vector<Node> w; vector<lld> chu[ 1005 ]; lld dp[ 1005 ]; lld *p; int main (){jizz fill(dp,dp+1005,-1); lld s,e,m,a,b;cin >> s >> e >> m >> a >> b; p = new lld[a+b+5]; for(int i = 0 ; i < m ; i++){ for(int j = 0 ; j < a+b ; j++){ lld t;cin >> t; chu[i]. PB (t); w. PB ({i,j,t}); } } bool t = 0; sort(w. begin (),w.