# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
689973 | 2023-01-29T23:50:59 Z | inwbear | Lutrija (COCI19_lutrija) | C++14 | 463 ms | 304 KB |
#include<bits/stdc++.h> using namespace std; typedef long long LL; vector<LL>ans; LL a,b; bool isprime(LL x){ if(x<2)return false; LL k=sqrt(x); for(LL i=2;i<=k&&i<x;i++){ if(x%i==0)return false; } return true; } bool to2(LL x,bool rev){ if(x==2){ if(rev)ans.push_back(2); return true; } bool p=false; LL rr=x; while(1){ if(!isprime(rr))break; if(isprime(rr-2)){ p=true; break; } rr=rr+2; } if(p){ if(rev){ for(LL i=x;i<=rr;i+=2)ans.push_back(i); ans.push_back(2); } else for(LL i=rr;i>=x;i-=2)ans.push_back(i); } return p; } int main(){ scanf("%lld %lld",&a,&b); if(to2(a,true)&&to2(b,false)){ printf("%d\n",ans.size()); for(int i=0;i<ans.size();i++)printf("%lld ",ans[i]); } else printf("-1"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 304 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 280 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 436 ms | 276 KB | Output is correct |
2 | Correct | 38 ms | 212 KB | Output is correct |
3 | Correct | 433 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 413 ms | 280 KB | Output is correct |
2 | Correct | 13 ms | 296 KB | Output is correct |
3 | Correct | 301 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 463 ms | 284 KB | Output is correct |
2 | Correct | 72 ms | 280 KB | Output is correct |
3 | Correct | 280 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 336 ms | 296 KB | Output is correct |
2 | Correct | 30 ms | 212 KB | Output is correct |
3 | Correct | 99 ms | 212 KB | Output is correct |