답안 #421868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
421868 2021-06-09T13:08:08 Z kai824 푸드 코트 (JOI21_foodcourt) C++17
7 / 100
1000 ms 524292 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
const int inf=LLONG_MAX;
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
#define pii pair<int,int>

deque<pii> dq[65005];//size, type...

int32_t main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int n,m,q;
  cin>>n>>m>>q;
  int a,b,c,d,e;
  while(q--){
    cin>>a;
    if(a==1){
      cin>>b>>c>>d>>e;
      for(int i=b;i<=c;i++){
        dq[i].eb(e,d);
      }
    }else if(a==2){
      cin>>b>>c>>d;
      for(int i=b;i<=c;i++){
        int e=d;
        while(e>0 && dq[i].size()>0){
          if(dq[i][0].f<=e){
            e-=dq[i][0].f;
            dq[i].pop_front();
          }else{
            dq[i][0].f-=e;
            e=0;
          }
        }
      }
    }else{
      cin>>b>>c;//cth customer...
      if(n<=2000){
        for(pii x:dq[b]){
          c-=x.f;
          if(c<=0){
            cout<<x.s<<'\n';
            goto end;
          }
        }
        cout<<"0\n";
        end:;
      }else{
        if(dq[b].size()>=c)cout<<dq[b][c-1].s<<'\n';
        else cout<<"0\n";
      }
    }
  }
  return 0;
}

Compilation message

foodcourt.cpp: In function 'int32_t main()':
foodcourt.cpp:53:24: warning: comparison of integer expressions of different signedness: 'std::deque<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   53 |         if(dq[b].size()>=c)cout<<dq[b][c-1].s<<'\n';
      |            ~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 44484 KB Output is correct
2 Correct 44 ms 44864 KB Output is correct
3 Correct 53 ms 51516 KB Output is correct
4 Correct 57 ms 54980 KB Output is correct
5 Correct 33 ms 43980 KB Output is correct
6 Correct 35 ms 43968 KB Output is correct
7 Correct 59 ms 56552 KB Output is correct
8 Correct 57 ms 52140 KB Output is correct
9 Correct 47 ms 44876 KB Output is correct
10 Correct 54 ms 51648 KB Output is correct
11 Correct 63 ms 48872 KB Output is correct
12 Correct 53 ms 44912 KB Output is correct
13 Correct 46 ms 45012 KB Output is correct
14 Correct 61 ms 46152 KB Output is correct
15 Correct 48 ms 46956 KB Output is correct
16 Correct 53 ms 46140 KB Output is correct
17 Correct 47 ms 44364 KB Output is correct
18 Correct 50 ms 44560 KB Output is correct
19 Correct 32 ms 44100 KB Output is correct
20 Correct 36 ms 44016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 44484 KB Output is correct
2 Correct 44 ms 44864 KB Output is correct
3 Correct 53 ms 51516 KB Output is correct
4 Correct 57 ms 54980 KB Output is correct
5 Correct 33 ms 43980 KB Output is correct
6 Correct 35 ms 43968 KB Output is correct
7 Correct 59 ms 56552 KB Output is correct
8 Correct 57 ms 52140 KB Output is correct
9 Correct 47 ms 44876 KB Output is correct
10 Correct 54 ms 51648 KB Output is correct
11 Correct 63 ms 48872 KB Output is correct
12 Correct 53 ms 44912 KB Output is correct
13 Correct 46 ms 45012 KB Output is correct
14 Correct 61 ms 46152 KB Output is correct
15 Correct 48 ms 46956 KB Output is correct
16 Correct 53 ms 46140 KB Output is correct
17 Correct 47 ms 44364 KB Output is correct
18 Correct 50 ms 44560 KB Output is correct
19 Correct 32 ms 44100 KB Output is correct
20 Correct 36 ms 44016 KB Output is correct
21 Correct 41 ms 44824 KB Output is correct
22 Correct 46 ms 45000 KB Output is correct
23 Correct 57 ms 51468 KB Output is correct
24 Correct 58 ms 55144 KB Output is correct
25 Correct 32 ms 44048 KB Output is correct
26 Correct 37 ms 44072 KB Output is correct
27 Correct 67 ms 56060 KB Output is correct
28 Correct 70 ms 53000 KB Output is correct
29 Correct 60 ms 46724 KB Output is correct
30 Correct 59 ms 51240 KB Output is correct
31 Correct 63 ms 48696 KB Output is correct
32 Correct 50 ms 44800 KB Output is correct
33 Correct 53 ms 44952 KB Output is correct
34 Correct 77 ms 47236 KB Output is correct
35 Correct 52 ms 45668 KB Output is correct
36 Correct 73 ms 46112 KB Output is correct
37 Correct 36 ms 44080 KB Output is correct
38 Correct 31 ms 44008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 44176 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 74 ms 89080 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 44484 KB Output is correct
2 Correct 44 ms 44864 KB Output is correct
3 Correct 53 ms 51516 KB Output is correct
4 Correct 57 ms 54980 KB Output is correct
5 Correct 33 ms 43980 KB Output is correct
6 Correct 35 ms 43968 KB Output is correct
7 Correct 59 ms 56552 KB Output is correct
8 Correct 57 ms 52140 KB Output is correct
9 Correct 47 ms 44876 KB Output is correct
10 Correct 54 ms 51648 KB Output is correct
11 Correct 63 ms 48872 KB Output is correct
12 Correct 53 ms 44912 KB Output is correct
13 Correct 46 ms 45012 KB Output is correct
14 Correct 61 ms 46152 KB Output is correct
15 Correct 48 ms 46956 KB Output is correct
16 Correct 53 ms 46140 KB Output is correct
17 Correct 47 ms 44364 KB Output is correct
18 Correct 50 ms 44560 KB Output is correct
19 Correct 32 ms 44100 KB Output is correct
20 Correct 36 ms 44016 KB Output is correct
21 Execution timed out 1095 ms 44176 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 779 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 44484 KB Output is correct
2 Correct 44 ms 44864 KB Output is correct
3 Correct 53 ms 51516 KB Output is correct
4 Correct 57 ms 54980 KB Output is correct
5 Correct 33 ms 43980 KB Output is correct
6 Correct 35 ms 43968 KB Output is correct
7 Correct 59 ms 56552 KB Output is correct
8 Correct 57 ms 52140 KB Output is correct
9 Correct 47 ms 44876 KB Output is correct
10 Correct 54 ms 51648 KB Output is correct
11 Correct 63 ms 48872 KB Output is correct
12 Correct 53 ms 44912 KB Output is correct
13 Correct 46 ms 45012 KB Output is correct
14 Correct 61 ms 46152 KB Output is correct
15 Correct 48 ms 46956 KB Output is correct
16 Correct 53 ms 46140 KB Output is correct
17 Correct 47 ms 44364 KB Output is correct
18 Correct 50 ms 44560 KB Output is correct
19 Correct 32 ms 44100 KB Output is correct
20 Correct 36 ms 44016 KB Output is correct
21 Correct 41 ms 44824 KB Output is correct
22 Correct 46 ms 45000 KB Output is correct
23 Correct 57 ms 51468 KB Output is correct
24 Correct 58 ms 55144 KB Output is correct
25 Correct 32 ms 44048 KB Output is correct
26 Correct 37 ms 44072 KB Output is correct
27 Correct 67 ms 56060 KB Output is correct
28 Correct 70 ms 53000 KB Output is correct
29 Correct 60 ms 46724 KB Output is correct
30 Correct 59 ms 51240 KB Output is correct
31 Correct 63 ms 48696 KB Output is correct
32 Correct 50 ms 44800 KB Output is correct
33 Correct 53 ms 44952 KB Output is correct
34 Correct 77 ms 47236 KB Output is correct
35 Correct 52 ms 45668 KB Output is correct
36 Correct 73 ms 46112 KB Output is correct
37 Correct 36 ms 44080 KB Output is correct
38 Correct 31 ms 44008 KB Output is correct
39 Execution timed out 1095 ms 44176 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 44484 KB Output is correct
2 Correct 44 ms 44864 KB Output is correct
3 Correct 53 ms 51516 KB Output is correct
4 Correct 57 ms 54980 KB Output is correct
5 Correct 33 ms 43980 KB Output is correct
6 Correct 35 ms 43968 KB Output is correct
7 Correct 59 ms 56552 KB Output is correct
8 Correct 57 ms 52140 KB Output is correct
9 Correct 47 ms 44876 KB Output is correct
10 Correct 54 ms 51648 KB Output is correct
11 Correct 63 ms 48872 KB Output is correct
12 Correct 53 ms 44912 KB Output is correct
13 Correct 46 ms 45012 KB Output is correct
14 Correct 61 ms 46152 KB Output is correct
15 Correct 48 ms 46956 KB Output is correct
16 Correct 53 ms 46140 KB Output is correct
17 Correct 47 ms 44364 KB Output is correct
18 Correct 50 ms 44560 KB Output is correct
19 Correct 32 ms 44100 KB Output is correct
20 Correct 36 ms 44016 KB Output is correct
21 Correct 41 ms 44824 KB Output is correct
22 Correct 46 ms 45000 KB Output is correct
23 Correct 57 ms 51468 KB Output is correct
24 Correct 58 ms 55144 KB Output is correct
25 Correct 32 ms 44048 KB Output is correct
26 Correct 37 ms 44072 KB Output is correct
27 Correct 67 ms 56060 KB Output is correct
28 Correct 70 ms 53000 KB Output is correct
29 Correct 60 ms 46724 KB Output is correct
30 Correct 59 ms 51240 KB Output is correct
31 Correct 63 ms 48696 KB Output is correct
32 Correct 50 ms 44800 KB Output is correct
33 Correct 53 ms 44952 KB Output is correct
34 Correct 77 ms 47236 KB Output is correct
35 Correct 52 ms 45668 KB Output is correct
36 Correct 73 ms 46112 KB Output is correct
37 Correct 36 ms 44080 KB Output is correct
38 Correct 31 ms 44008 KB Output is correct
39 Execution timed out 1095 ms 44176 KB Time limit exceeded
40 Halted 0 ms 0 KB -