Submission #698845

# Submission time Handle Problem Language Result Execution time Memory
698845 2023-02-14T12:57:23 Z Abrar_Al_Samit Strange Device (APIO19_strange_device) C++17
5 / 100
1 ms 468 KB
#include<bits/stdc++.h>
using namespace std;

long long gcd(long long x, long long y) {
    if (y == 0) return x;
    return gcd(y, x%y);
}
void PlayGround() {
  long long n, a, b;
  cin>>n>>a>>b;
  assert(n==1);

  vector<array<long long,2>>iner(n);
  for(int i=0; i<n; ++i) {
    cin>>iner[i][0]>>iner[i][1];
  }

  long long g = gcd(a, b+1);
  long long interval = (a / gcd(a, b+1));
  if(log10(interval)+log10(b)>18) {
    cout<<iner[0][1]-iner[0][0]+1<<'\n';
  } else {
    interval *= b;
    cout<<min(iner[0][1]-iner[0][0]+1, interval)<<'\n';
  }

  // cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  PlayGround();
  return 0;
}

Compilation message

strange_device.cpp: In function 'void PlayGround()':
strange_device.cpp:18:13: warning: unused variable 'g' [-Wunused-variable]
   18 |   long long g = gcd(a, b+1);
      |             ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -