結果
問題 | No.2207 pCr検査 |
ユーザー | 👑 kmjp |
提出日時 | 2023-02-04 00:22:21 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,366 bytes |
コンパイル時間 | 2,010 ms |
コンパイル使用メモリ | 199,668 KB |
実行使用メモリ | 77,796 KB |
最終ジャッジ日時 | 2023-09-15 20:41:53 |
合計ジャッジ時間 | 37,331 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 232 ms
48,484 KB |
testcase_01 | AC | 234 ms
48,340 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 305 ms
65,464 KB |
testcase_07 | AC | 346 ms
63,472 KB |
testcase_08 | AC | 343 ms
61,380 KB |
testcase_09 | RE | - |
testcase_10 | AC | 221 ms
58,908 KB |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | AC | 366 ms
52,716 KB |
testcase_15 | RE | - |
testcase_16 | WA | - |
testcase_17 | RE | - |
testcase_18 | AC | 903 ms
71,336 KB |
testcase_19 | WA | - |
testcase_20 | AC | 763 ms
67,232 KB |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | AC | 402 ms
54,836 KB |
testcase_25 | AC | 709 ms
65,672 KB |
testcase_26 | AC | 670 ms
63,320 KB |
testcase_27 | AC | 1,138 ms
77,796 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;} template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;} //------------------------------------------------------- int N; int P[202020],E[202020],C[11202020]; int V[11202020]; void solve() { int i,j,k,l,r,x,y; string s; FOR(i,10000001) V[i]=i; for(i=2;i<=10000000;i++) if(V[i]==i) { for(j=i;j<=10000000;j+=i) V[j]=i; } cin>>N; FOR(i,N) { cin>>P[i]>>E[i]; C[P[i]]=E[i]; } int D=N; for(int r=1;r<=P[N-1];r++) { x=P[N-1]+1-r; while(x>1) { C[V[x]]--; if(C[V[x]]==0) D--; x/=V[x]; } x=r; while(x>1) { if(C[V[x]]==0) D++; C[V[x]]++; x/=V[x]; } if(D==0) { cout<<P[N-1]<<" "<<r<<endl; return; } } cout<<"-1 -1"<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); cout.tie(0); solve(); return 0; }