Submission #2576282
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long int i=0;i<n;i++)
#define rep1(i,n) for(long long int i=1;i<=n;i++)
#define repU(i,bottom,ceiling) for(long long int (i)=(bottom);(i)<=(ceiling);(i)++)
#define repD(i,ceiling,bottom) for(long long int (i)=(ceiling);(i)>=(bottom);(i)--)
#define pub push_back
#define pob pop_back
#define pf printf
#define sf scanf
#define ci(a) cin>>a
#define lco(a) cout<<a<<endl
#define co(a) cout<<a
#define vci(v) for(long long int i=0;i<v.size();i++) cin>>v[i]
#define vco(v) for(long long int i=0;i<v.size();i++){ cout<<v[i]<<' '; } cout<<endl
#define mp make_pair
#define fir first
#define sec second
#define clr(arr) memset((arr),0,sizeof(arr))
#define Re return
typedef long long int ll;
typedef double db;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vb;
typedef vector<vector<double>> vvd;
typedef vector<long long int> vll;
typedef vector<vector<long long int>> vvll;
typedef pair<int,int> pii;
const string alphabet("abcdefghijklmnopqrstuvwxyz");
const vector<pair<int,int>> dir={{0,0},{1,0},{1,1},{0,1},{-1,1},{0,-1},{-1,-1},{0,-1},{1,-1}};
const long double Pi=3.141592653589793238462643383279502884197;
const long double Napier=2.71828182845904523536;
const int Inf=(int)2e9+1e8;
const int Mod=(int)1e9+7;
template<typename T,typename U>
inline pair<T,U> operator+(const pair<T,U> & l,const pair<T,U> & r) {
return {l.fir+r.fir,l.sec+r.sec};
}
template<typename T,typename U>
inline pair<T,U> operator-(const pair<T,U> & l,const pair<T,U> & r) {
return {l.fir-r.fir,l.sec-r.sec};
}
template<typename T,typename U>
inline pair<T,U> operator*(const pair<T,U> & l,const pair<T,U> & r) {
return {l.fir*r.fir,l.sec*r.sec};
}
template<typename T,typename U>
inline pair<T,U> operator/(const pair<T,U> & l,const pair<T,U> & r) {
return {l.fir/r.fir,l.sec/r.sec};
}
template<typename T> inline void Swap(T *x,T *y){ T tem=*x; *x=*y; *y=tem; }
inline long long int rem(long long int n,long long int m){
if(!m) return 0;
return (n<0?(n%m)+m:(n%m));
}
/*The main code follows below*/
int main(){
int k; ci(k);
ll Max,Min;
vll A;
rep(i,k){ ll a; ci(a); A.pub(a); }
Max=Min=2;
repD(i,k,1){
//lco(A.back());
ll RMax=Max%A.back();
ll RMin=Min%A.back();
//lco(RMax<<RMin);
if(Max-RMax<Min){ lco(-1); return 0; }
Max+=(A.back()-1-RMax);
Min+=(!RMin?0:(A.back()-RMin));
//lco(Min<<' '<<Max);
A.pob();
}
lco(Min<<' '<<Max);
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Ice Rink Game |
User |
amt |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
2902 Byte |
Status |
AC |
Exec Time |
44 ms |
Memory |
1528 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
500 / 500 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt, sample_03.txt |
All |
sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt |
Case Name |
Status |
Exec Time |
Memory |
sample_01.txt |
AC |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
sample_03.txt |
AC |
1 ms |
256 KB |
subtask_1_01.txt |
AC |
1 ms |
256 KB |
subtask_1_02.txt |
AC |
1 ms |
256 KB |
subtask_1_03.txt |
AC |
1 ms |
256 KB |
subtask_1_04.txt |
AC |
1 ms |
256 KB |
subtask_1_05.txt |
AC |
1 ms |
256 KB |
subtask_1_06.txt |
AC |
19 ms |
1400 KB |
subtask_1_07.txt |
AC |
44 ms |
1400 KB |
subtask_1_08.txt |
AC |
1 ms |
256 KB |
subtask_1_09.txt |
AC |
1 ms |
256 KB |
subtask_1_10.txt |
AC |
4 ms |
384 KB |
subtask_1_11.txt |
AC |
42 ms |
1400 KB |
subtask_1_12.txt |
AC |
42 ms |
1400 KB |
subtask_1_13.txt |
AC |
31 ms |
1400 KB |
subtask_1_14.txt |
AC |
41 ms |
1400 KB |
subtask_1_15.txt |
AC |
42 ms |
1400 KB |
subtask_1_16.txt |
AC |
4 ms |
512 KB |
subtask_1_17.txt |
AC |
31 ms |
1400 KB |
subtask_1_18.txt |
AC |
31 ms |
1400 KB |
subtask_1_19.txt |
AC |
28 ms |
1400 KB |
subtask_1_20.txt |
AC |
30 ms |
1400 KB |
subtask_1_21.txt |
AC |
30 ms |
1400 KB |
subtask_1_22.txt |
AC |
29 ms |
1400 KB |
subtask_1_23.txt |
AC |
1 ms |
256 KB |
subtask_1_24.txt |
AC |
2 ms |
256 KB |
subtask_1_25.txt |
AC |
43 ms |
1400 KB |
subtask_1_26.txt |
AC |
2 ms |
256 KB |
subtask_1_27.txt |
AC |
43 ms |
1528 KB |