Submission #5323823


Source Code Expand

//file_name:ABC14_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);

    int l[1000001] = {};
    int r[1000001] = {};

    rep(i,n){
        int a,b;
        cin >> a >> b;
        l[a]++;
        r[b]++;
    }


    int ans = 0;
    int count = 0;

    rep(i,1000002){
        count += l[i];
        ans = max(ans,count);
        count -= r[i];
    }


    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task C - AtColor
User Shibuyap
Language C++14 (GCC 5.4.1)
Score 100
Code Size 2793 Byte
Status AC
Exec Time 86 ms
Memory 8064 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:81:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
./Main.cpp:100:21: warning: iteration 1000001u invokes undefined behavior [-Waggressive-loop-optimizations]
         count -= r[i];
                     ^
./Main.cpp:5:35: note: containing loop
 #define rep(i,n) for(int i = 0; i < (n); ++i)
                                   ^
./Main.cpp:97:5: note: in expansion of macro ‘rep’
     rep(i,1000002){
     ^

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 30 / 30 70 / 70
Status
AC × 2
AC × 17
AC × 42
Set Name Test Cases
Sample subtask0_sample01.txt, subtask0_sample02.txt
Subtask1 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask0_sample01.txt, subtask0_sample02.txt
Subtask2 subtask0_sample01.txt, subtask0_sample02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt, subtask2_16.txt, subtask2_17.txt, subtask2_18.txt, subtask2_19.txt, subtask2_20.txt, subtask2_21.txt, subtask2_22.txt, subtask2_23.txt, subtask2_24.txt, subtask2_25.txt
Case Name Status Exec Time Memory
subtask0_sample01.txt AC 4 ms 8064 KB
subtask0_sample02.txt AC 5 ms 8064 KB
subtask1_01.txt AC 4 ms 8064 KB
subtask1_02.txt AC 4 ms 8064 KB
subtask1_03.txt AC 6 ms 8064 KB
subtask1_04.txt AC 6 ms 8064 KB
subtask1_05.txt AC 6 ms 8064 KB
subtask1_06.txt AC 6 ms 8064 KB
subtask1_07.txt AC 6 ms 8064 KB
subtask1_08.txt AC 6 ms 8064 KB
subtask1_09.txt AC 6 ms 8064 KB
subtask1_10.txt AC 6 ms 8064 KB
subtask1_11.txt AC 6 ms 8064 KB
subtask1_12.txt AC 6 ms 8064 KB
subtask1_13.txt AC 6 ms 8064 KB
subtask1_14.txt AC 6 ms 8064 KB
subtask1_15.txt AC 6 ms 8064 KB
subtask2_01.txt AC 66 ms 8064 KB
subtask2_02.txt AC 84 ms 8064 KB
subtask2_03.txt AC 63 ms 8064 KB
subtask2_04.txt AC 81 ms 8064 KB
subtask2_05.txt AC 73 ms 8064 KB
subtask2_06.txt AC 86 ms 8064 KB
subtask2_07.txt AC 82 ms 8064 KB
subtask2_08.txt AC 83 ms 8064 KB
subtask2_09.txt AC 82 ms 8064 KB
subtask2_10.txt AC 84 ms 8064 KB
subtask2_11.txt AC 81 ms 8064 KB
subtask2_12.txt AC 84 ms 8064 KB
subtask2_13.txt AC 86 ms 8064 KB
subtask2_14.txt AC 84 ms 8064 KB
subtask2_15.txt AC 83 ms 8064 KB
subtask2_16.txt AC 82 ms 8064 KB
subtask2_17.txt AC 85 ms 8064 KB
subtask2_18.txt AC 84 ms 8064 KB
subtask2_19.txt AC 85 ms 8064 KB
subtask2_20.txt AC 83 ms 8064 KB
subtask2_21.txt AC 83 ms 8064 KB
subtask2_22.txt AC 84 ms 8064 KB
subtask2_23.txt AC 82 ms 8064 KB
subtask2_24.txt AC 82 ms 8064 KB
subtask2_25.txt AC 83 ms 8064 KB