| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 154017 | hocky | NLO (COCI18_nlo) | C++14 | 831 ms | 512 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#define pb push_back
using namespace std;
typedef long long LL;
inline void fasterios(){
    //Do not use if interactive
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}
LL n,m,k;
struct dt{
    LL x,y,r;
};
vector <dt> all;
struct dtl{
    bool isOn;
    LL pos, idx;
    bool operator<(const dtl &other)const{
        if(pos != other.pos) return pos < other.pos;
        return isOn > other.isOn;
    }
};
int main(){
    fasterios();
    cin >> m >> n >> k;
    for(int i = 1;i <= k;i++){
        dt tmp; cin >> tmp.y >> tmp.x >> tmp.r;
        all.pb(tmp);
    }
    reverse(all.begin(),all.end());
    LL ans = 0;
    for(int i = 1;i <= n;i++){
        vector <dtl> lines;
        lines.pb({1,1,k});
        lines.pb({0,m,k});
        for(int j = 0;j < all.size();j++){
            LL dist_x = (all[j].x-i);
            LL diff = (all[j].r*all[j].r) - (dist_x*dist_x);
            if(diff < 0) continue;
            diff = sqrt(diff);
            lines.pb({1,all[j].y-diff,j});
            lines.pb({0,all[j].y+diff,j});
        }
        sort(lines.begin(),lines.end());
        set <LL> active_lines;
        LL pre = 0;
        for(int j = 0;j < lines.size();j++){
            if(lines[j].isOn == 1){
                if(pre < lines[j].pos-1){
                    LL smallest = *(active_lines.begin());
                    ans += (lines[j].pos-1-pre)*smallest;
                    pre = lines[j].pos-1;
                }
                active_lines.insert(lines[j].idx);
            }else{
                if(pre < lines[j].pos){
                    LL smallest = *(active_lines.begin());
                    ans += (lines[j].pos-pre)*smallest;
                    pre = lines[j].pos;
                }
                active_lines.erase(lines[j].idx);
            }
        }
    }
    printf("%lld",ans);
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
