zawatins-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub zawa-tin/zawatins-library

:heavy_check_mark: test/input3.test.cpp

Depends on

Code

#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/4/ALDS1_4_C"

#include "../src/template/input.hpp"
using namespace zawa::input;

#include "../src/template/output.hpp"
using namespace zawa::output;

#include <set>
#include <string>

int main() {
    int n;
    in(n);
    std::set<std::string> st;
    for (int _ = 0 ; _ < n ; _++) {
        std::string q, s; in(q, s);
        if (q[0] == 'i') {
            st.insert(s);
        }
        else {
            yesno(st.count(s), "yes", "no"); 
        }
    }
}
#line 1 "test/input3.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/4/ALDS1_4_C"

#line 2 "src/template/input.hpp"

#include <iostream>
#include <utility>
#include <vector>

namespace zawa::input {

template <typename T> 
void in(T& res) { std::cin >> res; }

template <typename Head, typename... Tail>
void in(Head& head, Tail&... tail) { in(head); in(tail...); }

template <typename T, typename U>
void in(std::pair<T, U>& res) { in(res.first); in(res.second); }

template <typename T>
void in(std::vector<T>& res) { for (auto& r : res) { in(r); } }

} // namespace zawa::input
#line 4 "test/input3.test.cpp"
using namespace zawa::input;

#line 2 "src/template/output.hpp"

#line 5 "src/template/output.hpp"
#include <string>

namespace zawa::output {

void out() { 
    std::cout << std::endl; 
}

template <class T>
void out(const T& a) { 
    std::cout << a << std::endl; 
}

template <class T>
void out(const std::vector<T>& as) { 
    for (std::size_t i = 0 ; i < as.size() ; i++) { 
        std::cout << as[i] << (i + 1 == as.size() ? '\n' : ' '); 
    } 
}

template <class Head, class... Tail>
void out(const Head& head, const Tail&... tail) { 
    std::cout << head; 
    if (sizeof...(tail)) { 
        std::cout << ' '; 
    } 
    out(tail...);
}

void yesno(bool flag, std::string yes = "Yes", std::string no = "No") {
    std::cout << (flag ? yes : no) << std::endl;
}

} // namespace zawa::output
#line 7 "test/input3.test.cpp"
using namespace zawa::output;

#include <set>
#line 11 "test/input3.test.cpp"

int main() {
    int n;
    in(n);
    std::set<std::string> st;
    for (int _ = 0 ; _ < n ; _++) {
        std::string q, s; in(q, s);
        if (q[0] == 'i') {
            st.insert(s);
        }
        else {
            yesno(st.count(s), "yes", "no"); 
        }
    }
}
Back to top page