답안 #166019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166019 2019-11-30T08:47:56 Z theStaticMind San (COCI17_san) C++14
96 / 120
477 ms 65540 KB
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
 //     freopen("q.gir","r",stdin);
 //     freopen("q.cik","w",stdout);
      int n,k,ans=0;
      cin>>n>>k;
      vector<int>arr(n+1,0),gold(n+1,0);
      map<int,int>data[n+1];
      data[0][0]=1;
      for(int i=1;i<=n;i++)cin>>arr[i]>>gold[i];
      for(int i=1;i<=n;i++){
            for(int j=0;j<i;j++){
                  if(arr[j]<=arr[i]){
                        for(map<int,int>::iterator itr=data[j].begin();itr!=data[j].end();itr++){
                              if(itr->first+gold[i]>=k){
                                    data[i][k]+=itr->second;
                              }
                              else data[i][itr->first+gold[i]]+=itr->second;
                        }
                  }
            }
            ans+=data[i][k];
      }
      cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 4856 KB Output is correct
2 Correct 4 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 14 ms 3452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 10148 KB Output is correct
2 Runtime error 477 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)