답안 #708106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
708106 2023-03-11T05:23:31 Z veehj 이상한 기계 (APIO19_strange_device) C++17
5 / 100
1682 ms 63776 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, bul=0;
  for(auto& u : mp){
    cnt+=u.S;
    // cout << "[" << u.first << ',' << u.second << ']' << cnt << endl;
    if(!bul){
      nw=u.F;
      bul=1;
    }
    if(!cnt){
      ans+=u.F-nw;
      // cout << ans << endl;
      bul=0;
    }
  }
  cout << ans;
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 15 ms 1208 KB Output is correct
3 Correct 17 ms 1236 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 929 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1610 ms 63776 KB Output is correct
3 Incorrect 1667 ms 63144 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1610 ms 63776 KB Output is correct
3 Incorrect 1667 ms 63144 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1610 ms 63776 KB Output is correct
3 Incorrect 1667 ms 63144 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 172 ms 10200 KB Output is correct
3 Correct 182 ms 10156 KB Output is correct
4 Correct 1662 ms 63212 KB Output is correct
5 Correct 159 ms 10316 KB Output is correct
6 Correct 166 ms 10172 KB Output is correct
7 Correct 171 ms 10220 KB Output is correct
8 Correct 169 ms 10280 KB Output is correct
9 Correct 167 ms 10256 KB Output is correct
10 Correct 159 ms 10204 KB Output is correct
11 Correct 162 ms 10188 KB Output is correct
12 Correct 154 ms 10208 KB Output is correct
13 Correct 159 ms 10184 KB Output is correct
14 Correct 1682 ms 63160 KB Output is correct
15 Incorrect 165 ms 9616 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 15 ms 1208 KB Output is correct
3 Correct 17 ms 1236 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -