# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
637115 | 2022-08-31T15:19:15 Z | Ahmed57 | Preokret (COCI18_preokret) | C++14 | 1 ms | 340 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a; vector<pair<int,int>> v; int col = 0; for(int i = 0;i<a;i++){ int x;cin>>x; v.push_back({x,0}); if(x<=1440)col++; } cin>>b; for(int i = 0;i<b;i++){ int x;cin>>x; v.push_back({x,1}); if(x<=1440)col++; } sort(v.begin(),v.end()); cout<<col<<"\n"; vector<pair<int,int>>z; int x = 0,y = 0 , ans = 0; for(int i = 0;i<a+b;i++){ if(v[i].second==0)x++; else y++; if(x!=y)z.push_back({x,y}); } for(int i = 1;i<z.size();i++){ if((z[i-1].first<z[i-1].second)!=(z[i].first<z[i].second))ans++; } cout<<ans<<"\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |