| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 141072 | 44442 | Preokret (COCI18_preokret) | C++11 | 4 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int a,b,as[2890],bs[2890],ok,okk,aa[2890],bb[2890],c[2890],va[2890],vb[2890];
set<int>s;
int main (){
ios::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
scanf("%d\n",&a);
for(int i=0;i<a;i++){
scanf("%d\n",&as[i]);
if(as[i]<1441)
ok++;
aa[as[i]]=1;
s.insert(as[i]);
}
scanf("%d",&b);
for(int j=0;j<b;j++){
scanf("\n%d",&bs[j]);
if(bs[j]<1441)
ok++;
bb[bs[j]]=1;
s.insert(bs[j]);
}
printf("%d\n",ok);
for(set<int>::iterator it=s.begin();it!=s.end();it++){
set<int>::iterator itt=s.lower_bound(*it);
itt--;
if(aa[*it]==1){
va[*it]=va[*itt]+1;
}
else
va[*it]=va[*itt];
if(bb[*it]==1){
vb[*it]=vb[*itt]+1;
}
else
vb[*it]=vb[*itt];
if(va[*it]>vb[*it])
c[*it]=1;
else if(vb[*it]>va[*it])
c[*it]=2;
else
c[*it]=0;
}
set<int>::iterator it=s.begin();
it++;
while(it!=s.end()){
set<int>::iterator d=s.lower_bound(*it);
d--;
set<int>::iterator itt=s.lower_bound(*d);
itt--;
if((c[*it]==1 and c[*itt]==2) or (c[*it]==2 and c[*itt]==1))
okk++;
it++;
}
printf("%d",okk);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
