Submission #91612

# Submission time Handle Problem Language Result Execution time Memory
91612 2018-12-28T16:28:14 Z model_code Journey (NOI18_journey) C++17
69 / 100
2000 ms 3832 KB
#include <iostream>
#include <algorithm>
using namespace std;
constexpr unsigned MAX_VAL = 500000001;
int main(){
    ios_base::sync_with_stdio(false);
    unsigned n,m,h;
    cin>>n>>m>>h;
    unsigned*arr=new unsigned[n*m];
    fill_n(arr,n*m,0);
    arr[0]=1;
    for(unsigned i=0;i<n-1;++i){
        for(unsigned j=0;j<h;++j){
            unsigned c,q;
            cin>>c>>q;
            if(c>i){
                for(unsigned k=q;k<m;++k){
                    for(unsigned l=0;l<=k-q;++l){
                        arr[c*m+k]=min(MAX_VAL,arr[c*m+k]+arr[i*m+l]);
                    }
                }
            }
        }
    }
    for(unsigned i=0;i<m;++i){
        if(i>0)cout<<' ';
        cout<<arr[(n-1)*m+i];
    }
    cout<<'\n';
    delete[] arr;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 12 ms 376 KB Output is correct
6 Correct 12 ms 424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 12 ms 376 KB Output is correct
6 Correct 12 ms 424 KB Output is correct
7 Correct 67 ms 1272 KB Output is correct
8 Correct 490 ms 3832 KB Output is correct
9 Correct 742 ms 1656 KB Output is correct
10 Execution timed out 2021 ms 1592 KB Time limit exceeded