답안 #1106090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1106090 2024-10-29T08:14:15 Z SoMotThanhXuan Inspections (NOI23_inspections) C++17
11 / 100
38 ms 17848 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, 399999, 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:93:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   93 |         freopen(NAME".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:94:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   94 |         freopen(NAME".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3920 KB Output is correct
2 Correct 2 ms 4052 KB Output is correct
3 Correct 2 ms 3920 KB Output is correct
4 Correct 2 ms 3920 KB Output is correct
5 Correct 2 ms 3920 KB Output is correct
6 Correct 2 ms 3920 KB Output is correct
7 Correct 3 ms 4176 KB Output is correct
8 Correct 2 ms 3920 KB Output is correct
9 Correct 2 ms 4176 KB Output is correct
10 Correct 2 ms 3920 KB Output is correct
11 Correct 2 ms 4076 KB Output is correct
12 Correct 2 ms 3920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3920 KB Output is correct
2 Correct 2 ms 4052 KB Output is correct
3 Correct 2 ms 3920 KB Output is correct
4 Correct 2 ms 3920 KB Output is correct
5 Correct 2 ms 3920 KB Output is correct
6 Correct 2 ms 3920 KB Output is correct
7 Correct 3 ms 4176 KB Output is correct
8 Correct 2 ms 3920 KB Output is correct
9 Correct 2 ms 4176 KB Output is correct
10 Correct 2 ms 3920 KB Output is correct
11 Correct 2 ms 4076 KB Output is correct
12 Correct 2 ms 3920 KB Output is correct
13 Incorrect 36 ms 15688 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3920 KB Output is correct
2 Correct 3 ms 4176 KB Output is correct
3 Incorrect 38 ms 17848 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3920 KB Output is correct
2 Correct 2 ms 4052 KB Output is correct
3 Correct 2 ms 3920 KB Output is correct
4 Correct 2 ms 3920 KB Output is correct
5 Correct 2 ms 3920 KB Output is correct
6 Correct 2 ms 3920 KB Output is correct
7 Correct 3 ms 4176 KB Output is correct
8 Correct 2 ms 3920 KB Output is correct
9 Correct 2 ms 4176 KB Output is correct
10 Correct 2 ms 3920 KB Output is correct
11 Correct 2 ms 4076 KB Output is correct
12 Correct 2 ms 3920 KB Output is correct
13 Incorrect 36 ms 15688 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3920 KB Output is correct
2 Correct 2 ms 4052 KB Output is correct
3 Correct 2 ms 3920 KB Output is correct
4 Correct 2 ms 3920 KB Output is correct
5 Correct 2 ms 3920 KB Output is correct
6 Correct 2 ms 3920 KB Output is correct
7 Correct 3 ms 4176 KB Output is correct
8 Correct 2 ms 3920 KB Output is correct
9 Correct 2 ms 4176 KB Output is correct
10 Correct 2 ms 3920 KB Output is correct
11 Correct 2 ms 4076 KB Output is correct
12 Correct 2 ms 3920 KB Output is correct
13 Incorrect 36 ms 15688 KB Output isn't correct
14 Halted 0 ms 0 KB -