Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.HashMap; import java.util.Map; import java.util.Scanner; //Co-occurrence Search public class Main{ void run(){ Scanner sc = new Scanner(System.in); boolean head = true; while(sc.hasNext()){ if(!head)sc.nextLine(); StringBuilder sb = new StringBuilder(); for(;;){ String s = sc.next...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class Main{ Scanner sc=new Scanner(System.in); int INF=1<<28; double EPS=1e-9; char[] s, key; void run(){ for(;;){ String lines=""; for(;;){ Strin...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; char chs[1001]; int main() { bool fi = false; string str; while (getline(cin, str) && str != "") { memset(chs, 0, sizeof(chs)); string ss; string tmp; if (fi) cout << endl << endl; else fi = true; while (...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-8; string gText; string gQuery; vector<int> gIndex[1024]; class State { public: int _min_pos; int _max_pos; int _query_i; State(int min_pos, int max_pos, int query_i) : _min_pos(min_pos), _max_pos(max_pos), _query_i(query_i) {} ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string str; bool first = true; while (getline(cin, str)) { string s = str; string minSizeStr; while (getline(cin, str), str != "") s += str; long long cnt = 0; string key; getline(cin, key); getline(cin, str); if (key.size(...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <iostream> #include <sstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <climits> #include <cfloat> using namespace std; int main() {...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { for (string si; getline(cin, si), cin;) { string s; do { s += si; getline(cin, si); } while (si != ""); string k; getline(cin, k); bool ap[128] = {}; for (int i = 0; i < k.size();) { if (ap[k[i]]++) { k.er...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int size = 51; int cnt[size]; int ksize; bool check() { for (int i = 0; i < ksize; i++) { if (cnt[i] == 0) return false; } return true; } int contain(string& K, char c) { for (int i = 0; i < ksize; i++) { if (c == K[i]) return i; } return -1; } voi...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.HashMap; import java.util.Map; import java.util.Scanner; //Co-occurrence Search public class Main{ void run(){ Scanner sc = new Scanner(System.in); boolean head = true; while(sc.hasNext()){ if(!head)sc.nextLine(); head = false; StringBuilder sb = new StringBuilder(); for(;;){ S...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool compare(string s1, string s2) { if (s1.size() == s2.size()) return s1 < s2; return s1.size() < s2.size(); } int main() { string in, sub; string seq; bool flag = true; while (getline(cin, in)) { if (!flag && (in.size() == 0 || cin.eof())) { if (cin...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string in; string key; int size; vector<int> pos; int find[50]; int npos; while (1) { in = ""; string tmp; while (1) { getline(cin, tmp); if (tmp.size() == 0) break; in += tmp; } key = ""; while (1) { ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-8; string gText; string gQuery; void print_text(const string& text) { int offset = 0; int text_i = 0; while (offset < text.size()) { for (text_i = offset; text_i < text.size(); text_i++) { if (text_i - offset >= 72) break; ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { for (string si; getline(cin, si), si != "";) { string s; do { s += si; getline(cin, si); } while (si != ""); string k; getline(cin, k); bool ap[128] = {}; for (int i = 0; i < k.size();) { if (ap[k[i]]++) { ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { for (string si; getline(cin, si), si != "";) { string s; do { s += si; getline(cin, si); } while (si != ""); string k; getline(cin, k); cin.ignore(); map<char, int> m; int f = 0, l = 1 << 30; int n = 0; set<...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); constexpr int NUM = 128; constexpr int WIDTH = 72; bool first = true; string line; while (getline(cin, line)) { if (first) first = false; else cout << endl; string text = ""; ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string str, pat; vector<char> num; str.reserve(1000001); num.reserve(1000001); pat.reserve(73); ios::sync_with_stdio(false); cin.tie(0); string split; while (true) { str.clear(); while (true) { getline(cin, pat); if (pat.em...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; static const double EPS = 1e-8; string gText; string gQuery; vector<int> gIndex[1024]; class State { public: int _min_pos; int _max_pos; int _query_i; State(int min_pos, int max_pos, int query_i) : _min_pos(min_pos), _max_pos(max_pos), _query_i(query_i) {} ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MAX = 51; string text, key; map<char, int> M; int numKey[MAX]; bool input() { text = ""; string s = ""; if (!getline(cin, s)) return false; if (s == "") return false; text = s; while (getline(cin, s) && s != "") text += s; getline(cin, s); key = s;...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> char s[1000000 + 1]; char sc[50 + 1]; char *find; int minret; char *find11; char aaa[1000]; char bbb[1000]; void print_find() { int i; for (i = 0; i <= minret; i++) printf("%c", find[i]); printf("\n"); } int my_strstr(char *s1, char *s2) { int mincnt, ret; extern int my_strstr_sub(cha...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
7 a 1 firstexampleistriv 7 nWWW.Alb 0 1 Wagner,Bach,Beethoven,Chopin,Brahms,Hindemith,Ives,Suk,Mozart,Stravinsky 1 CIIcharacterssuchas+,*,[,#,<,},_arenotexcludedinagivenstringasthisexampl eillustratesbyitself.Youshouldnotforgetthem.Onemorefactyoushouldnoticeis thatuppercaselettersandlowercaselettersaredisting...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int valid[256]; int cnt[256]; int kind; void add(char c) { if (!valid[c]) return; if (cnt[c]++) return; ++kind; } void sub(char c) { if (!valid[c]) return; if (--cnt[c]) return; --kind; } int main() { string in, str, key; bool f = true; while (getline(cin,...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MAX = 51; string text, key; map<char, int> M; int numKey[MAX]; bool input() { text = ""; string s; getline(cin, s); if (s == "") return false; text = s; while (getline(cin, s) && s != "") text += s; getline(cin, s); key = s; getline(cin, s); re...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; string S, K; const int INF = 1 << 28; void solve() { string ans; int len = INF, cnt = 0; int left = INF; int idx[K.length()]; for (int i = 0; i < K.length(); ++i) idx[i] = -1; for (int p = 0; p < S.length(); ++p) { for (int k = 0; k < K.length(); ++k) { ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool notfirst; const int size = 51; int cnt[size]; int ksize; bool check() { for (int i = 0; i < ksize; i++) { if (cnt[i] == 0) return false; } return true; } int contain(string& K, char c) { for (int i = 0; i < ksize; i++) { if (c == K[i]) return i; } r...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int h = 0, i; string s; while (getline(cin, s)) { string t = s; while (getline(cin, s) && s != "") t += s; string u; getline(cin, u); getline(cin, s); char z[256]; memset(z, 0, sizeof(z)); int uln = u.length(); for (i =...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool check(int begin, int end, vector<vector<int> > &ind) { if (begin > end) return false; for (int i = 0; i < (int)ind.size(); ++i) { if (ind[i].size() == 0) return false; vector<int>::iterator it_b = lower_bound(ind[i].begin(), ind[i].end(), begin); ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string text, key, temp; for (;;) { text = key = ""; while (getline(cin, text) && text.empty()) ; if (cin.eof()) return 0; while (getline(cin, temp) && !temp.empty()) text += temp; if (cin.eof()) return 0; while (getline(cin, ke...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool notfirst; const int size = 51; int cnt[size]; int ksize; bool check() { for (int i = 0; i < ksize; i++) { if (cnt[i] == 0) return false; } return true; } int contain(string& K, char c) { for (int i = 0; i < ksize; i++) { if (c == K[i]) return i; } r...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { for (string si; getline(cin, si), si != "";) { string s; do { s += si; getline(cin, si); } while (si != ""); string k; getline(cin, k); cin.ignore(); map<char, int> m; int f = 0, l = 1 << 30; int n = 0; for ...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string text, key, temp; for (;;) { text = key = ""; while (getline(cin, text) && text.empty()) ; if (cin.eof()) return 0; while (getline(cin, temp) && !temp.empty()) text += temp; if (cin.eof()) return 0; while (getline(cin, ke...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int valid[256]; int cnt[256]; int kind; void add(char c) { if (!valid[c]) return; if (cnt[c]++) return; ++kind; } void sub(char c) { if (!valid[c]) return; if (--cnt[c]) return; --kind; } int main() { string in, str, key; bool f = true; while (getline(cin,...
p00795 Co-occurrence Search
A huge amount of information is being heaped on WWW. Albeit it is not well-organized, users can browse WWW as an unbounded source of up-to-date information, instead of consulting established but a little out-of-date encyclopedia. However, you can further exploit WWW by learning more about keyword search algorithms. Fo...
{ "input": [ "Thefirstexampleistrivial.\n\nmfv\n\nAhugeamountofinformationisbeingheapedonWWW.Albeititisnot\nwell-organized,userscanbrowseWWWasanunboundedsourceof\nup-to-dateinformation,insteadofconsultingestablishedbutalittle\nout-of-dateencyclopedia.However,youcanfurtherexploitWWWby\nlearningmoreaboutkeywordsear...
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { string str; bool first = true; while (getline(cin, str)) { if (!first) cout << endl; string s = str; string minSizeStr; while (getline(cin, str), str != "") s += str; int cnt = 0; string key; getline(cin, key); if (key.size...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,m; cin >> n >> m; vector<int> after(n+2, 0); for(int i=0; i<m; i++){ int c,d; cin >> c >> d; after[c] = max(after[c], d); } int ans = 0; int farthest = 0; for(int i=0; i<=n; i++){ farthest = max(farthest, ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> int N, M; int imos[1010]; int main() { scanf("%d%d", &N, &M); for(int i=0; i<M; i++) { int l, r; scanf("%d%d", &l, &r); imos[l]++; imos[r]--; } for(int i=1; i<=N; i++) { imos[i] += imos[i-1]; } int prev = -1, ans = N + 1; for(int i=1; i<=N+...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> #include <vector> #define phb push_back #define mkp make_pair #define frs first #define scn second #define sz(x) int((x).size()) #define all(x) (x).begin(), (x).end() using namespace std; typedef pair< int, int > Pr; int N, M; vector< Pr > C; void read(); void solve(); bool...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <sstream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <ctime> #include <vector> #include <string> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <functional> #include <algorithm> using namespace std; #define ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <cstdio> #include <ctime> #include <assert.h> #include <chrono> #include <random> #include <numeric> #include <set> #include <deque> #include <stack> #include <bitset> using namespace std; typedef long long int ll; typed...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int dfs(int n, vector<vector<int> >& adj){ if((int)adj[n].size() == 0) return n; int ret=0; for(int i=0; i<(int)adj[n].size(); i++){ ret = max(ret, dfs(adj[n][i], adj)); } adj[n].clear(); return ret; } int main(){ int n,m; cin >...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; int main(){ int n,m; cin >> n >> m; vector<pii> r(m); for(int i=0;i<m;i++)cin >> r[i].first >> r[i].second; sort(r.begin(),r.end()); int s=-1,t=-1,sum=0; for(int i=0;i<m;i++){ if(r[i].first<=t){ t = max(t, r[i].second); ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<string> #include<vector> #include<queue> #include<stack> #include<map> #include<set> #include<algorithm> #include<functional> #include<cstdio> #include<cstdlib> #include<cmath> #include<cassert> #include<ctime> using namespace std; #define mind(a,b) (a>b?b:a) #define maxd(a,b) (a>b?a:b) #de...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <map> #include <set> #include <vector> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <numeric> #include <functional> using namespace std; #define Rep(b, e, i) for(int i = b; i <= e;...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" #define REP(i,n) for(ll i=0;i<n;++i) #define RREP(i,n) for(ll i=n-1;i>=0;--i) #define FOR(i,m,n) for(ll i=m;i<n;++i) #define RFOR(i,m,n) for(ll i=n-1;i>=m;--i) #define ALL(v) (v).begin(),(v).end() #define PB(a) push_back(a) #define UNIQUE(v) v.erase(unique(ALL(v)),v.end()); #define DUMP(v) REP...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> using namespace std; int main() { int N, m; cin >> N >> m; vector<bool> b(N); for (int i = 0; i < m; ++ i) { int c, d; cin >> c >> d; -- c; -- d; for (int j = c; j < d; ++ j) { b[j] = true; } } int r = N+1; for (int i = 0; i < N; ++ i) if (b[i]) r += 2; cout <<...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main() { int n,d,flg[1002]={}; cin >> n >> d; for(int i=0;i<d;i++) { int a,b; cin >>a>>b; flg[a] = max(flg[a],b); } int sta=0,sum=0,L=0,R=0; for(int i=0;i<=n;i++) { if(flg[i] != 0 && sta==1) R=max(R,flg[i]); else if(flg[i] != 0) L=i,R=flg[...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cmath> #include <cstring> #include <iostream> #include <algorithm> #include <queue> #include <vector> #include <map> using namespace std; typedef long long LL; int n,m,x,y; vector<int> v[1005]; int a[1005]; int ans,dq,len,nxt; int main() { scanf("%d%d",&n,&m); for (int i=...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> using namespace std; struct ioi{ int l,r; } seg[510]; int n, m; bool intersect(ioi a,ioi b){ if (a.l>b.l) swap(a,b); if (b.l<=a.r) return true; else return false; } ioi combine(ioi a,ioi b){ a.l = min(a.l, b.l); a.r = max(a.r, b.r); return a; } int main(){ cin >> ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define D(x) cout << #x " = " << x << endl #define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl #define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl #define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl; #define...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> using namespace std; int s[1010][2],n,m,ans; int f[1010]; int min(int a,int b){ return a<b?a:b; } int main(){ scanf("%d%d",&n,&m); for(int i=0;i<m;i++){ scanf("%d%d",&s[i][0],&s[i][1]); //s[i][0]--;]s[i][1]--; } for(int i=0;i<m;i++){ for(int j=i+1;j<m;j++){ if(s[j][1]<s[i][1]||(s[j][1]=...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> int main(){ int n,m; int sum[1010] ={}; scanf("%d%d",&n,&m); for(int i=0;i<m;i++){ int a,b; scanf("%d%d",&a,&b); sum[a-1]++; sum[b-1]--; } int ans=0; for(int i=0;i<n;i++){ sum[i+1] += sum[i]; ans += !!sum[i] * 2; } printf("%d\n",ans+(n+1)); return 0; }
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef pair<int,int> P; P t[1002]; int main() { int n, m; while (cin >> n >> m) { for (int i = 0; i < m; i++) { cin >> t[i].first >> t[i].second; } sort(t, t + m); vector<P> v; for (int i = 0; i < m; i++...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; typedef vector<int> vec; int main () { int N, m; cin >> N >> m; vec c(m), d(m); for (int i = 0; i < m; i++) { cin >> c[i] >> d[i]; } vec h(N + 1); for (int i = 0; i < m; i++) { if (c[i] < d[i]) { for (int j = c[i] + 1; ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(void){ int n,m; cin>>n>>m; vector<int> s(n+1,0); for(int i=0;i<m;i++){ int a,b; cin>>a>>b; s[a]++; s[b]--; } partial_sum(s.begin(),s.end(),s.begin()); cout<< n+1+ (n+1-count(s.begin(),s.end(),0))*2 <<endl; }
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
// Author : // Date : // Problem: // Solution: // Comment: #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <cmath> #include <cstring> #define pp push #define pb push_back #define mp make_pair #define xx first #define...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N,m; cin >> N >> m; vector<pair<int,int>> pos; for (int i=0;i<m;++i){ int c,d; cin >> c >> d; pos.emplace_back(c,d); } pos.emplace_back(N+1,N+1); sort(pos.begin(),pos.e...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
// // Created by 拓真 on 2018/06/24. // #include "bits/stdc++.h" using namespace std; int x[11234]; int main(){ int n,m; cin>>n>>m; for(int i=0;i<n;i++)x[i]=1; for(int i=0;i<m;i++){ int c,d; cin>>c>>d; for(int j=c;j<d;j++){ x[j]=3; } } int ans=0; ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; vector<int> pos(n+1,1); for(int i=0;i<m;i++){ int c,d; cin>>c>>d; for(int j=c;j<d;j++) pos[j]=3; } cout<<accumulate(pos.begin(),pos.end(),0)<<endl; return 0; }
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main() { long long int n, m; cin >> n >> m; long long int v[1001] = {}; for ( long long int i = 0; i < m; i++ ) { long long int in_c, in_d; cin >> in_c >> in_d; v[ in_c ]++; v[ in_d ]--; } for ( long long int i = 1; i <= n; i++ ) { v[i...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> #define pb emplace_back #define xx first #define yy second using namespace std; typedef pair<int, int>pi; vector<pi>vec; bool vis[1003]; int main() { int n, m, x, y; while(scanf("%d %d", &n, &m)==2) { vec.clear(); for(int i=0; i<m; i++) { scanf("%d...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int n, m, answer = 0; cin >> n >> m; bool flag = 0; int start_point; vector<int> shop_gap(n + 1, 0); for (int i = 0; i < m; i++) { int c, d; cin >> c >> d; for (int j = c; j ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cctype> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #d...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <algorithm> #include <bitset> #include <cstdio> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> P; typedef pair<L...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <map> #define f first #define s second using namespace std; int n,m; int main(){ cin >> n >> m; vector<int> vec(n+2,0); for(int i = 0;i < m;i++){ int f,t; cin >> t >> f; vec[t]++; vec[f]--; } for(int...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define each(itr,v) for(auto itr:v) #define pb(s) push_back(s) #define mp(a,b) make_pair(a,b) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n, m; cin >> n >> m; vector<bool> shop(n + 1, false); for (int i = 0; i < m; i++) { int c, d; cin >> c >> d; for (int j = c; j < d; j++) shop[j] = true; } int ans = 0; for (int i = 0;...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <complex> #include <sstream> #include <string> #include <algorithm> #include <deque> #include <list> #include <map> #include <numeric> #include <queue> #include <vector> #include <set> #include <limits> #include <cstdio> #include <cctype> #include <cmath> #include <cstring> #include <cstdli...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
//#include<bits/stdc++.h> #include<iostream> #include<iomanip> #include<cmath> #include<cstdlib> #include<cstring> #include<string> #include<algorithm> #include<vector> #include<queue> #include<stack> #include<map> #include<numeric> #include<bitset> #include<limits> #include<unordered_map> #include<functional> using na...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main() { int n, m, i, f[1002] = {0}; cin >> n >> m; for (i = 0; i < m; i++) { int c, d; cin >> c >> d; f[c]++; f[d]--; } int ans = n + 1; for (i = 1; i < n + 2; i++) { f[i] += f[i - 1]; if (f[i]) ans += 2; } cout << ans << endl; return 0; }
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
python2
N, m = map(int, raw_input().split()) three = [False]*N for loop in xrange(m): c, d = map(int, raw_input().split()) if c < d: three[c:d] = [True]*len(three[c:d]) ans = 0 for i in xrange(N): ans += 1 if three[i]: ans += 2 print ans+1
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; //#define int int64_t #define CHOOSE(a) CHOOSE2 a #define CHOOSE2(a0,a1,a2,a3,x,...) x #define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal) #define REP2(i, s, n) REP1(i, s, < signed(n), ++) #define REP3(i, n) REP2(i, 0, n...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define _USE_MATH_DEFINES #include <cstdio> #include <cstdlib> #include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; typedef pair<long long int, long long int> P; long long int INF = 1e18; int DP[2000] = {}; int main(){ ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(){ vector<pair<int, int>> cd; int N, m, c, d; cin >> N >> m; int ans = N + 1; for(int i = 0; i < m; ++i){ cin >> c >> d; cd.push_back({c, d}); } sort(cd.begin(), cd.end()); int start = 0, end = 0; for(int i = 0; ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { int n, m; cin >> n >> m; vector<int> imos(n + 2, 0); REP(i, m) { int c, d; cin >> c >> d; imos[c]++; imos[d]--; } REP(i, n + 1) imos[i + 1] += imos[i]; int ans = n + 1; REP(i,...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.*; import java.math.BigDecimal; import java.util.*; public class Main { static int INF = 2 << 27; static int[] vx = {1,0,-1,0}; static int[] vy = {0,1,0,-1}; public static void main(String[] args) { //FastScanner sc = new FastScanner(); Scanner sc = new Scanner(System.in); PrintWriter out = n...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <cstdio> #include <cstring> #include <string> #include <cmath> #include <iostream> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <bitset> using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
python3
import sys reader=(token for line in sys.stdin for token in line.split()) while 1: try: n=int(next(reader)) m=int(next(reader)) except: break a=[1]*(n+1) for i in range(m): c=int(next(reader))-1 d=int(next(reader))-1 for i in range(c,d): a[i]=3 print(sum(a))
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <cctype> #include <limits.h> #include <math.h> #include <complex> #include <bitset> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <cstring> #include <string> #include <sstream> #include <algorithm> #include <iomanip> #include <iostream> #define V...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#define __USE_MINGW_ANSI_STDIO 0 #include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll using VI = vector<int>; using VVI = vector<VI>; using PII = pair<int, int>; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #defi...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define LOG(...) fprintf(stderr, __VA_ARGS__) //#define LOG(...) #define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i) #define REP(i, n) for(int i=0; i<(int)(n); ++i) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define EXIST(s, e) ((...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int N , M , ans = 0; cin >> N >> M; vector<int>data((N + 2)*2); for(size_t i = 0; i < M; i++) { int a , b; cin >> a >> b; if(b > a) { data[a*2]++; data[b*2+1]--; } } for(size_t i = 1; i < (N + 2)*2; i++) { data[i] += data[i...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define for_(i,a,b) for(int i=a;i<b;++i) #define allof(a) a.begin(),a.end() typedef pair< int, int > pii; int N, m; int main() { cin >> N >> m; vector< pii > vp; for_(i,0,m) { int c, d; cin >> c >> d; vp.push_back(pii(c,d)); } sort(allof(vp)); vector< pi...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); constexpr int MAX_N = 1000; int n, m; cin >> n >> m; bitset<MAX_N> back; for(int i = 0; i < m; ++i) { int c, d; cin >> c >> d; if(c > d) continue; for(int j = c; j < d; ++j) { back[j] = true...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; int main() { for (int n, m; scanf("%d%d", &n, &m) == 2; ) { vector<int> a(n + 1, 0); for (int i = 0; i < m; ++ i) { int u, v; scanf("%d%d", &u, &v); a[u] ++; a[v] --; } int ret(0); for (int...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; vector<int> G[1111]; int N,M; int main(){ cin >> N >> M; for(int i=0;i<M;i++){ int c,d; cin >> c >> d; if( c < d ) G[c].push_back(d); } int res = 0; for(int i=1;i<=N+1;i++){ int rmax = i; if( G[i].empty() ){ res ++; continue; } f...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> P; typedef vector<int> VI; typedef vector<VI> VVI; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const int INF = numeric_limits<int>::max() / 2; const int NEG_INF = numeric_limits<int>::min() / 2; const in...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <algorithm> #include <vector> #include <utility> using namespace std; int main() { int N, M; cin >> N >> M; vector<pair<int,int>> V(M); for(int i = 0; i < M; ++i) { cin >> V[i].first >> V[i].second; } sort(V.begin(), V.end()); int ans = N - 1 + 2; int index = 0; while(i...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); Interval[] p = new Interval[m]; for(int i=0;i<m;i++) { p[...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> using namespace std; int n, q, a, b; int x[100000], sum; int main() { cin >> n >> q; for (int i = 0; i < q; i++) { cin >> a >> b; for (int j = a; j < b; j++) { x[j] = 1; } } for (int i = 0; i < n; i++) { sum += 1 + x[i] * 2; } cout << sum + 1 << endl; return 0; }
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <utility> #include <cstdio> #define C first #define D second #define MAXN 1100 using namespace std; typedef pair<int,int> pii; pii res[MAXN]; int add[MAXN]; bool cmp (const pii &a,const pii &b) { return a.C<b.C; } ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,x,y) for(int i=(x);i<(y);++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define print(x) #endif const int inf=1e9; const int64_t inf64=1e18; c...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, m; int a[1000]; int main() { scanf("%d %d", &n, &m); for (int i = 0; i < m; i++){ int c, d; scanf("%d %d", &c, &d); --c, --d; for (int i = c; i < d; i++){ a[i] = 1; } } int res = 0; for (int i = 0; i < n; i++){ if (a[i]) res += 3; else res++...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
java
public class Main{ public void run(java.io.InputStream in, java.io.PrintStream out){ java.util.Scanner sc = new java.util.Scanner(in); int n, m; int[] c, d, count; int i, j, ans; n = sc.nextInt(); m = sc.nextInt(); c = new int[m]; d = new int[m]; count = new int[n]; for(i = 0;i < m;i++){...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <algorithm> #include <functional> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <sstream> #include <iostream> #include <iomanip> #include <vector> #include <list> #include <stack> #include <queue> #include <map> #include <set> #include <bitset> #include <cl...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <iomanip> #include <cmath> #include <cassert> using namespace std; typedef pair<int, int> P; const int INF = 1 << 28; int dp[510][1010]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; while(c...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<algorithm> using namespace std; int n,t[1010]; int c[1010],d[1010]; int main() { int m; cin>>n>>m; for(int i=0;i<m;i++) { int l,r;cin>>l>>r; t[l]++;t[r]--; } for(int i=1;i<=n;i++)t[i]+=t[i-1]; int ans=n+1; for(int i=1;i<=n;i++)ans+=!!t[i]*2; cout<<ans<<endl; }
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int N, m; int main() { cin >> N >> m; typedef pair< int, int > pii; set< pii > interval; for (int i=0; i<m; ++i) { int c, d; cin >> c >> d; // left side auto it = interval.lower_bound(pii(c, 0)); if (it != interval.begin()) { --it; if (c <= (*it...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <map> #include <set> #include <vector> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <numeric> #include <functional> using namespace std; #define Rep(b, e, i) for(int i = b; i <= e;...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
python3
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin bisect_left = bisect.bisect_left bisect_right = bisect.bisect_right def LI(): ret...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <vector> using namespace std; int main(void){ int n, m; cin >> n >> m; vector<int> s(n+2, 0); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; s[a]++; s[b]--; } for (int i = 0; i < n+2; i++) s[i+1] += s[i]; int l = 0, ...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define F first #define S second typedef pair<int,int> P; int main() { int n,m; cin >> n >> m; map<int,int> ma; for(int i=0; i<m; i++) { int x,y; cin >> x >> y; if(ma.count(y)) ma[y]=min(ma[y],x); else ma[y]=x; } ma[0]=0; vector<P> a; for(ma...
p00926 Shopping
Example Input 10 3 3 7 8 9 2 5 Output 23
{ "input": [ "10 3\n3 7\n8 9\n2 5" ], "output": [ "23" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);++i) #define mp make_pair #define pb push_back #define F first #define S second #define endl '\n' #define ALL(a) (a).begin(),(a).end() #define SZ(a) (int)((a).size()) typedef long long ll; typedef pair<int,int> PI; int main(int argc,...