답안 #256205

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
256205 2020-08-02T11:27:10 Z uacoder123 Lutrija (COCI19_lutrija) C++14
21 / 70
350 ms 520 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))

typedef int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <lli> vi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int c[1001]={},f=0;
  for(int i=2;i<=1000;++i)
  {
    int ch=1,s=sqrt(i);
    for(int j=2;j<=s;++j)
    {
      if(i%j==0)
      {
        ch=0;
        break;
      }
    }
    c[i]=ch;
  }
  int a,b,che=0;
  cin>>a>>b;
  if(a>b)
  {
    che=1;
    swap(a,b);
  }
  vi v;
  v.pb(a);
  if(a%6==5)
    v.pb(a+2);
  if((a%6!=5&&a!=b)||a+2!=b)
  {
    if(a!=2)
      v.pb(2);
    if(c[b+2]==1)
    {
      v.pb(b+2);
      f=1;
    }
    else if(c[b-2]==1)
    {
      f=1;
      v.pb(b-2);
    }
    v.pb(b);
  }
  else
  {
      f=1;
  }
  if(f==1)
  {
    if(che==1)
      reverse(all(v));
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();++i)
      cout<<v[i]<<' ';
    cout<<endl;
  }
  else
    cout<<"-1"<<endl;
  return(0);
}

Compilation message

lutrija.cpp: In function 'int main()':
lutrija.cpp:74:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.size();++i)
                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 335 ms 512 KB Execution killed with signal 7 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 321 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 350 ms 520 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 318 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -