답안 #797190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
797190 2023-07-29T07:45:17 Z vjudge1 푸드 코트 (JOI21_foodcourt) C++17
9 / 100
1000 ms 136188 KB

// Author : حسن

#include <bits/stdc++.h>



using namespace std;

#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"


const int N = 7e4 + 9 , mod = 1e9 + 7;
ll  a[N] = {},  us[N] , dp[N] = {} , b[N];
deque<int>d[N];
void solve(){
    ll q , i , j , m ,n, z , s  = 0, f, l , r , k , x , y , mn  = 1e18 , mx = -1;
    cin>>n>>m>>q;
    set<ll>st;
    while(q--){
        cin>>k;
        if(k == 1){
            cin>>l>>r>>x>>y;
            for(i = l; i <=r ;i++)
                d[i].pb(x) , st.insert(i);
        }else if(k == 2){
            cin>>l>>r>>x;
            auto it = st.lower_bound(l);
            while(st.size() && it != st.end() && *it <= r){
            i = *it;
            s = 0;
            while(d[i].size() && s < x){
                d[i].pop_front();
                s++;
            }
            if(d[i].size() == 0)
                st.erase(i);
            it = st.lower_bound(i + 1);
            }
        }else{
            cin>>x>>y;
            if(d[x].size() >= y)
                cout<<d[x][y - 1]<<"\n";
            else
                cout<<0<<"\n";
        }
    }
}

int main(){

     TL;
     /*
     #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
     #endif
     */
int t = 1;
//cin>>t;

while(t--)
     {
     solve();
     }

}
// Author : حسن

Compilation message

foodcourt.cpp: In function 'void solve()':
foodcourt.cpp:56:28: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   56 |             if(d[x].size() >= y)
      |                ~~~~~~~~~~~~^~~~
foodcourt.cpp:31:16: warning: unused variable 'j' [-Wunused-variable]
   31 |     ll q , i , j , m ,n, z , s  = 0, f, l , r , k , x , y , mn  = 1e18 , mx = -1;
      |                ^
foodcourt.cpp:31:26: warning: unused variable 'z' [-Wunused-variable]
   31 |     ll q , i , j , m ,n, z , s  = 0, f, l , r , k , x , y , mn  = 1e18 , mx = -1;
      |                          ^
foodcourt.cpp:31:38: warning: unused variable 'f' [-Wunused-variable]
   31 |     ll q , i , j , m ,n, z , s  = 0, f, l , r , k , x , y , mn  = 1e18 , mx = -1;
      |                                      ^
foodcourt.cpp:31:61: warning: unused variable 'mn' [-Wunused-variable]
   31 |     ll q , i , j , m ,n, z , s  = 0, f, l , r , k , x , y , mn  = 1e18 , mx = -1;
      |                                                             ^~
foodcourt.cpp:31:74: warning: unused variable 'mx' [-Wunused-variable]
   31 |     ll q , i , j , m ,n, z , s  = 0, f, l , r , k , x , y , mn  = 1e18 , mx = -1;
      |                                                                          ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 47712 KB Output is correct
2 Correct 58 ms 47936 KB Output is correct
3 Correct 51 ms 49120 KB Output is correct
4 Correct 67 ms 50220 KB Output is correct
5 Correct 24 ms 47444 KB Output is correct
6 Correct 24 ms 47400 KB Output is correct
7 Correct 78 ms 50152 KB Output is correct
8 Correct 80 ms 49576 KB Output is correct
9 Correct 80 ms 47968 KB Output is correct
10 Correct 77 ms 49444 KB Output is correct
11 Correct 82 ms 48740 KB Output is correct
12 Correct 80 ms 47924 KB Output is correct
13 Correct 96 ms 48468 KB Output is correct
14 Correct 123 ms 48576 KB Output is correct
15 Correct 88 ms 48444 KB Output is correct
16 Correct 121 ms 48552 KB Output is correct
17 Correct 54 ms 47600 KB Output is correct
18 Correct 86 ms 47700 KB Output is correct
19 Correct 26 ms 47444 KB Output is correct
20 Correct 26 ms 47512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 47712 KB Output is correct
2 Correct 58 ms 47936 KB Output is correct
3 Correct 51 ms 49120 KB Output is correct
4 Correct 67 ms 50220 KB Output is correct
5 Correct 24 ms 47444 KB Output is correct
6 Correct 24 ms 47400 KB Output is correct
7 Correct 78 ms 50152 KB Output is correct
8 Correct 80 ms 49576 KB Output is correct
9 Correct 80 ms 47968 KB Output is correct
10 Correct 77 ms 49444 KB Output is correct
11 Correct 82 ms 48740 KB Output is correct
12 Correct 80 ms 47924 KB Output is correct
13 Correct 96 ms 48468 KB Output is correct
14 Correct 123 ms 48576 KB Output is correct
15 Correct 88 ms 48444 KB Output is correct
16 Correct 121 ms 48552 KB Output is correct
17 Correct 54 ms 47600 KB Output is correct
18 Correct 86 ms 47700 KB Output is correct
19 Correct 26 ms 47444 KB Output is correct
20 Correct 26 ms 47512 KB Output is correct
21 Incorrect 57 ms 47608 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 47500 KB Output is correct
2 Correct 68 ms 47492 KB Output is correct
3 Correct 72 ms 47444 KB Output is correct
4 Correct 73 ms 47444 KB Output is correct
5 Correct 92 ms 47476 KB Output is correct
6 Correct 92 ms 47492 KB Output is correct
7 Correct 39 ms 47496 KB Output is correct
8 Correct 37 ms 47516 KB Output is correct
9 Correct 64 ms 48216 KB Output is correct
10 Correct 64 ms 48628 KB Output is correct
11 Correct 75 ms 48988 KB Output is correct
12 Correct 62 ms 48680 KB Output is correct
13 Correct 70 ms 48476 KB Output is correct
14 Correct 77 ms 48632 KB Output is correct
15 Correct 99 ms 48952 KB Output is correct
16 Correct 109 ms 48968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 61 ms 95928 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 47712 KB Output is correct
2 Correct 58 ms 47936 KB Output is correct
3 Correct 51 ms 49120 KB Output is correct
4 Correct 67 ms 50220 KB Output is correct
5 Correct 24 ms 47444 KB Output is correct
6 Correct 24 ms 47400 KB Output is correct
7 Correct 78 ms 50152 KB Output is correct
8 Correct 80 ms 49576 KB Output is correct
9 Correct 80 ms 47968 KB Output is correct
10 Correct 77 ms 49444 KB Output is correct
11 Correct 82 ms 48740 KB Output is correct
12 Correct 80 ms 47924 KB Output is correct
13 Correct 96 ms 48468 KB Output is correct
14 Correct 123 ms 48576 KB Output is correct
15 Correct 88 ms 48444 KB Output is correct
16 Correct 121 ms 48552 KB Output is correct
17 Correct 54 ms 47600 KB Output is correct
18 Correct 86 ms 47700 KB Output is correct
19 Correct 26 ms 47444 KB Output is correct
20 Correct 26 ms 47512 KB Output is correct
21 Correct 59 ms 47500 KB Output is correct
22 Correct 68 ms 47492 KB Output is correct
23 Correct 72 ms 47444 KB Output is correct
24 Correct 73 ms 47444 KB Output is correct
25 Correct 92 ms 47476 KB Output is correct
26 Correct 92 ms 47492 KB Output is correct
27 Correct 39 ms 47496 KB Output is correct
28 Correct 37 ms 47516 KB Output is correct
29 Correct 64 ms 48216 KB Output is correct
30 Correct 64 ms 48628 KB Output is correct
31 Correct 75 ms 48988 KB Output is correct
32 Correct 62 ms 48680 KB Output is correct
33 Correct 70 ms 48476 KB Output is correct
34 Correct 77 ms 48632 KB Output is correct
35 Correct 99 ms 48952 KB Output is correct
36 Correct 109 ms 48968 KB Output is correct
37 Execution timed out 1083 ms 62012 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1068 ms 136188 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 47712 KB Output is correct
2 Correct 58 ms 47936 KB Output is correct
3 Correct 51 ms 49120 KB Output is correct
4 Correct 67 ms 50220 KB Output is correct
5 Correct 24 ms 47444 KB Output is correct
6 Correct 24 ms 47400 KB Output is correct
7 Correct 78 ms 50152 KB Output is correct
8 Correct 80 ms 49576 KB Output is correct
9 Correct 80 ms 47968 KB Output is correct
10 Correct 77 ms 49444 KB Output is correct
11 Correct 82 ms 48740 KB Output is correct
12 Correct 80 ms 47924 KB Output is correct
13 Correct 96 ms 48468 KB Output is correct
14 Correct 123 ms 48576 KB Output is correct
15 Correct 88 ms 48444 KB Output is correct
16 Correct 121 ms 48552 KB Output is correct
17 Correct 54 ms 47600 KB Output is correct
18 Correct 86 ms 47700 KB Output is correct
19 Correct 26 ms 47444 KB Output is correct
20 Correct 26 ms 47512 KB Output is correct
21 Incorrect 57 ms 47608 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 47712 KB Output is correct
2 Correct 58 ms 47936 KB Output is correct
3 Correct 51 ms 49120 KB Output is correct
4 Correct 67 ms 50220 KB Output is correct
5 Correct 24 ms 47444 KB Output is correct
6 Correct 24 ms 47400 KB Output is correct
7 Correct 78 ms 50152 KB Output is correct
8 Correct 80 ms 49576 KB Output is correct
9 Correct 80 ms 47968 KB Output is correct
10 Correct 77 ms 49444 KB Output is correct
11 Correct 82 ms 48740 KB Output is correct
12 Correct 80 ms 47924 KB Output is correct
13 Correct 96 ms 48468 KB Output is correct
14 Correct 123 ms 48576 KB Output is correct
15 Correct 88 ms 48444 KB Output is correct
16 Correct 121 ms 48552 KB Output is correct
17 Correct 54 ms 47600 KB Output is correct
18 Correct 86 ms 47700 KB Output is correct
19 Correct 26 ms 47444 KB Output is correct
20 Correct 26 ms 47512 KB Output is correct
21 Incorrect 57 ms 47608 KB Output isn't correct
22 Halted 0 ms 0 KB -