Submission #987326

# Submission time Handle Problem Language Result Execution time Memory
987326 2024-05-22T14:55:12 Z huutuan Sails (IOI07_sails) C++14
30 / 100
1000 ms 7348 KB
#include<bits/stdc++.h>

using namespace std;

#define int long long

const int N=1e5+10;
int n;
int a[N], b[N];
pair<int, int> c[N];
int cnt[N];

int32_t main(){
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   cin >> n;
   for (int i=1; i<=n; ++i) cin >> a[i] >> b[i], c[i]={a[i], b[i]};
   sort(c+1, c+n+1);
   int ans=0;
   for (int i=1; i<=n; ++i){
      a[i]=c[i].first, b[i]=c[i].second;
      vector<pair<int, int>> v;
      for (int j=1; j<=a[i]; ++j) v.emplace_back(cnt[j], j);
      sort(v.begin(), v.end());
      for (int j=0; j<b[i]; ++j) ans+=cnt[v[j].second]++;
   }
   cout << ans << '\n';
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2392 KB Output is correct
2 Correct 8 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 257 ms 2652 KB Output is correct
2 Execution timed out 1049 ms 4692 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 3200 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1033 ms 4724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 3560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 7348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 4372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 4700 KB Time limit exceeded
2 Halted 0 ms 0 KB -