답안 #1106095

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1106095 2024-10-29T08:18:05 Z SoMotThanhXuan Inspections (NOI23_inspections) C++17
29 / 100
45 ms 29256 KB
// absolutely incredible
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i <= b; ++i)
#define REP(i, a, b) for(int i = a; i >= b; --i)
#define pb push_back
#define left _________left
#define right _________right
#define NAME ""
const int mod = 1e9 + 7;
bool maximize(int &u, int v){
    if(v > v){
        u = v;
        return true;
    }
    return false;
}
bool minimize(int &u, int v){
    if(v < u){
        u = v;
        return true;
    }
    return false;
}
bool maximizell(long long &u, long long v){
    if(v > u){
        u = v;
        return true;
    }
    return false;
}
bool minimizell(long long &u, long long v){
    if(v < u){
        u = v;
        return true;
    }
    return false;
}
int fastPow(int a, int n){
    if(n == 0) return 1;
    int t = fastPow(a, n >> 1);
    t = 1ll * t * t % mod;
    if(n & 1) t = 1ll * t * a % mod;
    return t;
}
void add(int &u, int v){
    u += v;
    if(u >= mod) u -= mod;
}
void sub(int &u, int v){
    u -= v;
    if(u < 0) u += mod;
}
const int maxN = 2e5 + 5;
int n, m, q, l[maxN], r[maxN];
namespace subtask12{
    bool check(){
        return n <= 2000 && m <= 2000;
    }
    int last[maxN];
    const int lim = 4e6 + 1;
    int t[lim], cnt;
    int res[lim];
    void solve(){
        FOR(i, 1, m){
            FOR(j, l[i], r[i]){
                t[++cnt] = j;
            }
        }
        FOR(i, 1, cnt){
            if(last[t[i]] == 0)last[t[i]] = i;
            else{
                res[i - last[t[i]] - 1]++;
                last[t[i]] = i;
            }
        }
        REP(i, 4000000 - 1, 0)res[i] += res[i + 1];
        while(q--){
            long long s;
            cin >> s;
            if(s >= 4000000)cout << 0 << " ";
            else{
                cout << res[s] << ' ';
            }
        }
    }
}
void solve(){
    cin >> n >> m >> q;
    FOR(i, 1, m)cin >> l[i] >> r[i];
    if(subtask12 :: check()) return subtask12 :: solve();
}
int main(){
    if(fopen(NAME"inp", "r")){
        freopen(NAME".inp", "r", stdin);
        freopen(NAME".out", "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
//    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Compilation message

Main.cpp: In function 'bool maximize(int&, int)':
Main.cpp:12:10: warning: self-comparison always evaluates to false [-Wtautological-compare]
   12 |     if(v > v){
      |        ~ ^ ~
Main.cpp: In function 'int main()':
Main.cpp:95:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   95 |         freopen(NAME".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:96:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   96 |         freopen(NAME".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 18000 KB Output is correct
2 Correct 5 ms 18132 KB Output is correct
3 Correct 5 ms 18000 KB Output is correct
4 Correct 5 ms 18000 KB Output is correct
5 Correct 5 ms 18000 KB Output is correct
6 Correct 5 ms 18000 KB Output is correct
7 Correct 5 ms 18424 KB Output is correct
8 Correct 5 ms 18000 KB Output is correct
9 Correct 5 ms 18256 KB Output is correct
10 Correct 4 ms 18000 KB Output is correct
11 Correct 4 ms 18000 KB Output is correct
12 Correct 6 ms 18000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 18000 KB Output is correct
2 Correct 5 ms 18132 KB Output is correct
3 Correct 5 ms 18000 KB Output is correct
4 Correct 5 ms 18000 KB Output is correct
5 Correct 5 ms 18000 KB Output is correct
6 Correct 5 ms 18000 KB Output is correct
7 Correct 5 ms 18424 KB Output is correct
8 Correct 5 ms 18000 KB Output is correct
9 Correct 5 ms 18256 KB Output is correct
10 Correct 4 ms 18000 KB Output is correct
11 Correct 4 ms 18000 KB Output is correct
12 Correct 6 ms 18000 KB Output is correct
13 Correct 36 ms 25672 KB Output is correct
14 Correct 34 ms 20048 KB Output is correct
15 Correct 39 ms 29008 KB Output is correct
16 Correct 42 ms 29256 KB Output is correct
17 Correct 31 ms 20560 KB Output is correct
18 Correct 45 ms 29176 KB Output is correct
19 Correct 29 ms 27208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 18000 KB Output is correct
2 Correct 5 ms 18256 KB Output is correct
3 Correct 34 ms 27596 KB Output is correct
4 Incorrect 2 ms 2384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 18000 KB Output is correct
2 Correct 5 ms 18132 KB Output is correct
3 Correct 5 ms 18000 KB Output is correct
4 Correct 5 ms 18000 KB Output is correct
5 Correct 5 ms 18000 KB Output is correct
6 Correct 5 ms 18000 KB Output is correct
7 Correct 5 ms 18424 KB Output is correct
8 Correct 5 ms 18000 KB Output is correct
9 Correct 5 ms 18256 KB Output is correct
10 Correct 4 ms 18000 KB Output is correct
11 Correct 4 ms 18000 KB Output is correct
12 Correct 6 ms 18000 KB Output is correct
13 Correct 36 ms 25672 KB Output is correct
14 Correct 34 ms 20048 KB Output is correct
15 Correct 39 ms 29008 KB Output is correct
16 Correct 42 ms 29256 KB Output is correct
17 Correct 31 ms 20560 KB Output is correct
18 Correct 45 ms 29176 KB Output is correct
19 Correct 29 ms 27208 KB Output is correct
20 Incorrect 1 ms 2384 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 18000 KB Output is correct
2 Correct 5 ms 18132 KB Output is correct
3 Correct 5 ms 18000 KB Output is correct
4 Correct 5 ms 18000 KB Output is correct
5 Correct 5 ms 18000 KB Output is correct
6 Correct 5 ms 18000 KB Output is correct
7 Correct 5 ms 18424 KB Output is correct
8 Correct 5 ms 18000 KB Output is correct
9 Correct 5 ms 18256 KB Output is correct
10 Correct 4 ms 18000 KB Output is correct
11 Correct 4 ms 18000 KB Output is correct
12 Correct 6 ms 18000 KB Output is correct
13 Correct 36 ms 25672 KB Output is correct
14 Correct 34 ms 20048 KB Output is correct
15 Correct 39 ms 29008 KB Output is correct
16 Correct 42 ms 29256 KB Output is correct
17 Correct 31 ms 20560 KB Output is correct
18 Correct 45 ms 29176 KB Output is correct
19 Correct 29 ms 27208 KB Output is correct
20 Correct 5 ms 18000 KB Output is correct
21 Correct 5 ms 18256 KB Output is correct
22 Correct 34 ms 27596 KB Output is correct
23 Incorrect 2 ms 2384 KB Output isn't correct
24 Halted 0 ms 0 KB -