map<int, int>note1
을 생성Source Code
#include <iostream> #include <map> using namespace std; int main() { int T; cin >> T; while (T--) { int N, M; map <int, int> note1; cin >> N; for (int i = 0; i < N; i++) { int n; cin >> n; note1.insert(make_pair(n, 1)); } cin >> M; for (int i = 0; i < M; i++) { int note2; cin >> note2; if (note1[note2]) { cout << "1" << endl; } else cout << "0" << endl; } } return 0; }
→ 위 코드를 제출했더니 시간 초과 발생...