답안 #170539

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170539 2019-12-25T15:16:44 Z mdn2002 Unija (COCI17_unija) C++14
80 / 100
680 ms 65540 KB
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
multiset<int>ms;
int n,k,a[10000047];
vector<int>v[1000506];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("lemonade.in","r",stdin);
    //freopen("lemonade.out","w",stdout);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        x/=2;
        y/=2;
        if(a[y+1]==0)a[y+1]=++k;
        ms.insert(x);
        v[a[y+1]].push_back(x);
    }
    long long ans=0;
    for(int i=1;i<=10000004;i++)
    {
        for(int j=0;j<v[a[i]].size();j++)
        {
            ms.erase(ms.lower_bound(v[a[i]][j]));
        }
        if(ms.size()==0)break;
        ans+=*--ms.end();
    }
    cout<<ans*4;
}

Compilation message

unija.cpp: In function 'int main()':
unija.cpp:28:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v[a[i]].size();j++)
                     ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 23772 KB Output is correct
2 Correct 23 ms 23800 KB Output is correct
3 Correct 25 ms 23888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 23800 KB Output is correct
2 Correct 24 ms 23808 KB Output is correct
3 Correct 29 ms 23928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 23928 KB Output is correct
2 Correct 24 ms 23928 KB Output is correct
3 Correct 30 ms 23900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 24312 KB Output is correct
2 Correct 27 ms 24328 KB Output is correct
3 Correct 27 ms 24304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 680 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 23876 KB Output is correct
2 Correct 23 ms 23800 KB Output is correct
3 Correct 23 ms 23788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 26572 KB Output is correct
2 Correct 47 ms 26472 KB Output is correct
3 Correct 49 ms 26584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 32632 KB Output is correct
2 Correct 135 ms 32820 KB Output is correct
3 Correct 136 ms 33016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 469 ms 48760 KB Output is correct
2 Correct 510 ms 48948 KB Output is correct
3 Correct 463 ms 49128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 672 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -