답안 #136660

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
136660 2019-07-26T05:08:40 Z KLPP 이상한 기계 (APIO19_strange_device) C++14
10 / 100
5000 ms 524292 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
lld GCD(lld x, lld y){
  if(y==0)return x;
  return GCD(y,x%y);
}

int main(){
  lld n,A,B;
  cin>>n>>A>>B;
  lld l[n];
  lld r[n];
  rep(i,0,n)cin>>l[i]>>r[i];
  lld D=GCD(A,B+1);
  set<pair<lld,lld> >s;
  rep(i,0,n){
    for(lld j=l[i];j<=r[i];j++){
      s.insert(pair<lld,lld>((j+(j/B))%A,j%B));
    }
  }
  cout<<s.size()<<endl;
  //trav(a,s)cout<<a.first<<" "<<a.second<<endl;
  return 0;
}

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:18:7: warning: unused variable 'D' [-Wunused-variable]
   lld D=GCD(A,B+1);
       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 95 ms 12868 KB Output is correct
3 Correct 135 ms 18560 KB Output is correct
4 Correct 4 ms 888 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 12 ms 1144 KB Output is correct
10 Correct 2 ms 252 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 65 ms 7096 KB Output is correct
16 Correct 62 ms 7288 KB Output is correct
17 Correct 295 ms 10952 KB Output is correct
18 Correct 2 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Runtime error 4062 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 204 ms 32312 KB Output is correct
3 Correct 227 ms 32100 KB Output is correct
4 Correct 208 ms 30588 KB Output is correct
5 Execution timed out 5022 ms 78208 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2822 ms 78608 KB Output is correct
3 Execution timed out 5082 ms 474616 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2822 ms 78608 KB Output is correct
3 Execution timed out 5082 ms 474616 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2822 ms 78608 KB Output is correct
3 Execution timed out 5082 ms 474616 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 2386 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 95 ms 12868 KB Output is correct
3 Correct 135 ms 18560 KB Output is correct
4 Correct 4 ms 888 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 504 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 12 ms 1144 KB Output is correct
10 Correct 2 ms 252 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 65 ms 7096 KB Output is correct
16 Correct 62 ms 7288 KB Output is correct
17 Correct 295 ms 10952 KB Output is correct
18 Correct 2 ms 380 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Runtime error 4062 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
21 Halted 0 ms 0 KB -