Submission #1294243


Source Code Expand

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <limits>
using namespace std;
typedef long long ll;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FOREACH(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
 


struct PrimeNumbers {
    vector<bool> sieve;
    vector<int> prime;
    PrimeNumbers(int n) : sieve(n+1,true) {
        sieve[0] = sieve[1] = false;
        for(long long i=2; i<sieve.size(); i++) {
            if(sieve[i]) {
                prime.push_back((int)i);
                for(long long j=i*i; j<sieve.size(); j+=i) {
                    sieve[j] = false;
                }
            }
        }
    }
    bool isPrime(int n) { return sieve[n]; }
    int size(void) { return (int)prime.size(); }
    int  operator [] (int n) { return  prime[n]; }
    bool operator == (int n) { return  sieve[n]; }
    bool operator != (int n) { return !sieve[n]; }
};

int main() {

    PrimeNumbers p(1000000);
    
    int n; cin >> n;
    n = n * (n+1) / 2;
    if(p == n) cout << "WANWAN" << endl;
    if(p != n) cout << "BOWWOW" << endl;

    return 0;
}

Submission Info

Submission Time
Task A - ホリドッグ
User kosakkun
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1704 Byte
Status AC
Exec Time 7 ms
Memory 1020 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 4
AC × 16
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask0_sample_03.txt, subtask0_sample_04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 7 ms 1020 KB
subtask0_sample_02.txt AC 7 ms 1020 KB
subtask0_sample_03.txt AC 7 ms 1020 KB
subtask0_sample_04.txt AC 7 ms 1020 KB
subtask1_01.txt AC 7 ms 1020 KB
subtask1_02.txt AC 7 ms 1020 KB
subtask1_03.txt AC 7 ms 1020 KB
subtask1_04.txt AC 7 ms 1020 KB
subtask1_05.txt AC 7 ms 1020 KB
subtask1_06.txt AC 7 ms 1020 KB
subtask1_07.txt AC 7 ms 1020 KB
subtask1_08.txt AC 7 ms 1020 KB
subtask1_09.txt AC 7 ms 1020 KB
subtask1_10.txt AC 7 ms 1020 KB
subtask1_11.txt AC 7 ms 1020 KB
subtask1_12.txt AC 7 ms 1020 KB