This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 | |
| # Codeforces.ru problem tag analysis. | |
| import simplejson | |
| import urllib2 | |
| import re | |
| result = dict() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| #include <vector> | |
| #include <list> | |
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <cmath> | |
| #include <map> | |
| #include <stack> | |
| #include <sstream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <climits> | |
| using namespace std; | |
| int main(int, char**) { | |
| int n = 0; | |
| cin >> n; | |
| vector<vector<pair<int, int> > > g(n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <algorithm> | |
| #include <vector> | |
| using namespace std; | |
| int bsearch(vector<int> a, int left, int right, int what) { | |
| if (right < left) return -1; | |
| int middle = left + (right - left)/2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <algorithm> | |
| #include <vector> | |
| using namespace std; | |
| void msort(vector<int>::iterator left, vector<int>::iterator right) { | |
| if (right - left <= 1) return; | |
| msort(left, left + (right - left)/2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 | |
| from SqlHelper import SqlHelper | |
| import string | |
| import re | |
| import sys | |
| from SqlHelper import SqlHelper | |
| sql = SqlHelper() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 | |
| import string | |
| import re | |
| import sys | |
| from SqlHelper import SqlHelper | |
| sql = SqlHelper() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using namespace std; | |
| vector<vector<int> > g; | |
| vector<bool> used; | |
| vector<int> result; | |
| void dfs(int n) { | |
| used[n] = true; | |
| for (int i = 0; i < g[n].size(); i++) { | |
| if (!used[g[n][i]]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| std::vector<unsigned> kmp_prefix_function(std::string s) { | |
| size_t n = s.size(); | |
| std::vector<unsigned> result(n); | |
| for (int i = 1; i < n; i++) { | |
| int j = result[i-1]; | |
| while (j > 0 && s[i] != s[j]) | |
| j = result[j-1]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| std::vector<unsigned> trivial_prefix_function(std::vector<unsigned> & prefix, std::string s) { | |
| prefix.resize(s.length()); | |
| for (int i = 0; i < s.length(); ++i) | |
| for (int j = 0; j <= i; ++j) | |
| if (s.substr(0, j) == s.substr(i - j + 1, j)) | |
| prefix[i] = j; | |
| return prefix; | |
| } |