Submission #708117

# Submission time Handle Problem Language Result Execution time Memory
708117 2023-03-11T05:51:04 Z veehj Strange Device (APIO19_strange_device) C++17
5 / 100
1751 ms 63280 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()
 
int main() {
  ll n, a, b; cin >> n >> a >> b;
  map<ll, ll> mp;
  while(n--){
    ll l, r; cin >> l >> r;
    l%=a*b;
    r%=a*b; 
    if(l>r){
      mp[l]++;
      mp[a*b]--;
      mp[0]++;
      mp[r+1]--;
    }
    else{
      mp[l]++;
      mp[r+1]--;
    }
  }
  // 1 0 1 -1 -1 0 1 0 -1
  // 1 1 2  1  0 0 1 1  0
  ll cnt=0, nw=0, ans=0, pcnt=0;
  for(auto& u : mp){
    cnt+=u.S;
    // cout << "[" << u.first << ',' << u.second << ']' << cnt << endl;
    if(!pcnt) nw=u.F;
    if(!cnt) ans+=u.F-nw;
    pcnt=cnt;
  }
  cout << ans;
} 
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 18 ms 1108 KB Output is correct
3 Correct 15 ms 1156 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 891 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1512 ms 63276 KB Output is correct
3 Incorrect 1574 ms 63120 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1512 ms 63276 KB Output is correct
3 Incorrect 1574 ms 63120 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1512 ms 63276 KB Output is correct
3 Incorrect 1574 ms 63120 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 156 ms 6748 KB Output is correct
3 Correct 166 ms 6784 KB Output is correct
4 Correct 1620 ms 63280 KB Output is correct
5 Correct 157 ms 6788 KB Output is correct
6 Correct 159 ms 6732 KB Output is correct
7 Correct 161 ms 6732 KB Output is correct
8 Correct 152 ms 6708 KB Output is correct
9 Correct 151 ms 6808 KB Output is correct
10 Correct 185 ms 6928 KB Output is correct
11 Correct 183 ms 6860 KB Output is correct
12 Correct 156 ms 6884 KB Output is correct
13 Correct 167 ms 6904 KB Output is correct
14 Correct 1751 ms 63124 KB Output is correct
15 Incorrect 193 ms 7384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 18 ms 1108 KB Output is correct
3 Correct 15 ms 1156 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -