Submission #860439

#TimeUsernameProblemLanguageResultExecution timeMemory
860439nnhzzzExhibition (JOI19_ho_t2)C++14
100 / 100
46 ms10020 KiB
#include<bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i = (a); i<=(b); ++i) #define REPD(i,a,b) for(int i = (a); i>=(b); --i) #define REPDIS(i,a,b,c) for(int i = (a); i<=(b); i += c) #define task "test" #define task1 "nnhzzz" #define ALL(x) (x).begin(),(x).end() #define SZ(x) (int)(x).size() #define MASK(x) (1LL<<x) #define BIT(x,i) ((x>>i)&1LL) #define vi vector<int> #define vvi vector<vi> #define pii pair<int,int> #define vpii vector<pii> #define fi first #define se second #define ld long double #define ll long long #define int ll //-------------------------------------------------------------------------------// template<typename T> bool mini(T &a, T b){if(a>b){a=b;return true;}return false;} template<typename T> bool maxi(T &a, T b){if(a<b){a=b;return true;}return false;} //-------------------------------------------------------------------------------// const int MAXN = 5e5+7,N = 1e5+7,inf = 1e9,LOG = 20; const int MOD = 1e9+7,MOD1 = 123456789; //-------------------------------------------------------------------------------// pii a[MAXN]; int c[MAXN]; void solve(){ int n,m; cin >> n >> m; REP(i,0,n-1) cin >> a[i].se >> a[i].fi; REP(i,0,m-1) cin >> c[i]; sort(a,a+n); sort(c,c+m); int res = 0,j = m-1; REPD(i,n-1,0){ if(j==-1) break; if(a[i].se<=c[j]){ --j; ++res; } } cout << res; } signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(task".inp","r")){ freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } if(fopen(task1".inp","r")){ freopen(task1".inp","r",stdin); freopen(task1".out","w",stdout); } solve(); return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:54:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:55:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |         freopen(task".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:58:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |         freopen(task1".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:59:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 |         freopen(task1".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...