Submission #753877

# Submission time Handle Problem Language Result Execution time Memory
753877 2023-06-06T08:50:03 Z bgnbvnbv Sails (IOI07_sails) C++14
30 / 100
1000 ms 3148 KB
#include<bits/stdc++.h>
#define TASKNAME "codeforce"
#define pb push_back
#define pli pair<int,int>
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
const ll maxN=2e5;
const ll inf=1e18;
const ll mod=1e9+7;
pli a[maxN],cc[maxN];
ll h[maxN],ans=0;
ll n;
void solve()
{
    cin >> n;
    for(int i=1;i<=n;i++) cin >> a[i].fi >> a[i].se;
    sort(a+1,a+n+1);
    for(int i=1;i<=1e5;i++) h[i]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=a[i].fi;j++) cc[j]={h[j],j};
        sort(cc+1,cc+a[i].fi+1);
        for(int j=1;j<=a[i].se;j++)
        {
            ans+=cc[j].fi;
            h[cc[j].se]++;
        }
    }
    cout << ans;
}
int main()
{
    fastio
    //freopen(TASKNAME".INP","r",stdin);
    //freopen(TASKNAME".OUT","w",stdout);
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 1 ms 1092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1100 KB Output is correct
2 Correct 1 ms 1092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1096 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 9 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 288 ms 1164 KB Output is correct
2 Execution timed out 1073 ms 1504 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 1336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 1712 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 2084 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 3148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 2988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 3112 KB Time limit exceeded
2 Halted 0 ms 0 KB -