Submission #893649

# Submission time Handle Problem Language Result Execution time Memory
893649 2023-12-27T08:39:28 Z vjudge1 Segments (IZhO18_segments) C++17
0 / 100
5000 ms 11952 KB
// 以上帝的名义
// 候选硕士
#include <bits/stdc++.h>

#ifdef local
#include "algo/debug.h"
#else
#define dbg(x...) 0
#endif

using namespace std ;
using ll = long long ;
using ld = long double ;

int32_t main() {
    int n, t ;
    scanf("%d%d", &n, &t) ;
    int last = 0 ;
    map<pair<int,int>,int> cnt ;
    map<int,pair<int,int>> ind ;
    int idx = 0 ;
    for (int i = 0 ; i < n ; i++ ){
        int type ; scanf("%d", &type) ;
        if (type == 1) {
            int a, b ; scanf("%d%d", &a, &b) ;
            int l = (a ^ (last * t)) ;
            int r = (b ^ (last * t)) ;
            cnt[{l,r}]++ ; idx++ ;
            ind[idx] = {l, r} ;
//            dbg(type, l, r) ;
        } else if (type == 2) {
            int j ; cin >> j ;
            auto c = ind[j] ;
            cnt[c]-- ;
            if (cnt[c] == 0) cnt.erase(c) ;
        } else {
            int a, b, k ;scanf("%d%d%d", &a, &b, &k) ;
            int l = (a ^ (t * last)) ;
            int r = (b ^ (t * last)) ;
            int ans = 0 ;
            for (auto [c, p] : cnt) {
                auto [L, R] = c ;
                L = max(L, l) , R = min(R , r) ;
                if (R - L + 1 >= k) {
                    ans++ ;
                }
            }
//            dbg(type, l, r) ;
            printf("%d\n", ans) ;
            last = ans ;
        }
    }
    return 0 ;
}

// 希望白银

Compilation message

segments.cpp: In function 'int32_t main()':
segments.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%d%d", &n, &t) ;
      |     ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:23:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         int type ; scanf("%d", &type) ;
      |                    ~~~~~^~~~~~~~~~~~~
segments.cpp:25:29: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |             int a, b ; scanf("%d%d", &a, &b) ;
      |                        ~~~~~^~~~~~~~~~~~~~~~
segments.cpp:37:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             int a, b, k ;scanf("%d%d%d", &a, &b, &k) ;
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5045 ms 8076 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 103 ms 4432 KB Output is correct
2 Correct 75 ms 4304 KB Output is correct
3 Correct 168 ms 4468 KB Output is correct
4 Correct 82 ms 4436 KB Output is correct
5 Execution timed out 5075 ms 11412 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 4432 KB Output is correct
2 Correct 78 ms 4628 KB Output is correct
3 Correct 76 ms 4620 KB Output is correct
4 Correct 89 ms 4640 KB Output is correct
5 Execution timed out 5055 ms 11952 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -