Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | 8 test python 3.6 | roman velichkin | 1196. Экзамен по истории | 31 янв 2021 17:37 | 3 | use sets it's easy with them | | TL 8, хотя разогнал на столько на сколько можно было | Ivan | 1196. Экзамен по истории | 31 янв 2021 17:35 | 4 | Сначала пробовал через множества, потом сократил через map всегда валился на 8 тесте по времени Решил напрячься Сел и написал два модуля, чтобы работать с битами На преподавателе включаю биты На студенте проверяю и прибавляю к ответу Сдаю задачу, уже в предвкушении надписи "Accepted", как тут мои глаза лезут на лоб. Снова "TL8" Что это за монстр такой этот восьмой тест?) Обычный бинарный поиск в этой задаче же. | | A methodical way to solve(definitely can be improved) using c++ | tdnnojtupbkmuhehvb | 1197. Один в поле воин | 30 янв 2021 09:38 | 1 | #include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; while(n--){ string s; int a,b; cin>>s; a = s[0]-'a'+1; b = s[1]-'0'; a = min(a,9-a); b = min(b,9-b); if(a==b){ if(a==1) printf("2\n"); else if(a==2) printf("4\n"); else printf("8\n"); } else { if((a==1&&b==2)||(a==2&&b==1)) printf("3\n"); else if((a==1&&b>=3)||(a>=3&&b==1)) printf("4\n"); else if((a==2&&b>=3)||(a>=3&&b==2)) printf("6\n"); else if(a>2&&b>2)printf("8\n"); } } return 0; } | | Limit for n <= 10^4 in russian version, and n <= 10^5 in english version | c_pp | 1906. Исчезнувшая цивилизация | 28 янв 2021 23:16 | 3 | | | How to copy value? | Zergatul | 2028. URCAPL, эпизод 2 | 27 янв 2021 07:01 | 2 | I am stuck with this, it seems impossible to value from input to 2 registers. Ok, you can actually read n from input multiple times. And you can reduce value in current register to zero while increasing 2 (or more) other registers. This leads to copy operation. | | WA#9 | Zergatul | 2027. URCAPL, эпизод 1 | 27 янв 2021 06:11 | 2 | WA#9 Zergatul 30 ноя 2020 03:04 My limit was 10^4, not 10^5 | | If WA 1 | Toshpulatov (MSU Tashkent) | 1732. Министерство правды | 26 янв 2021 08:31 | 1 | If WA 1 Toshpulatov (MSU Tashkent) 26 янв 2021 08:31 | | WA18 | Ilya Konik | 1593. Квадратная страна. Версия 2 | 25 янв 2021 17:40 | 1 | WA18 Ilya Konik 25 янв 2021 17:40 Wrong answer 18. Can anybody help me, please? | | Условия | Toshpulatov (MSU Tashkent) | 1487. Китайский футбол | 25 янв 2021 10:58 | 1 | Условия Toshpulatov (MSU Tashkent) 25 янв 2021 10:58 В задаче сказано, проверить существует ли такая команда 'x' что она обыграет и команду A и команду В, если существует то ответ No иначе YES в таком случае можно использовать bitset | | Memory limit for 41 test!!! | FullMetal | 1780. Код Грея | 23 янв 2021 03:48 | 4 | Who many test???????????????????? ??0??1 ?0000? the answer is: 000001 000001 I'm also hung in testcase 53,who can help me?both test data or thought is ok. | | My explanation | Vladimir Putin | 2018. Дебютный альбом | 22 янв 2021 04:11 | 2 | I defined three functions: C(i) - the number of ways to make the album if it consists of only i songs. A(i) - the number of ways ending in 1. B(i) - the number of ways ending in 2. C(i) = A(i) + B(i) A(i) = 1 if i <= 1 = C(i-1) if 1< i <=a = C(i-1) - B(i-a-1) i>a Notice that if i <= a there's no way to have more than a 1's, so we call C(i-1) and 'append' 1 at position i. The number of ways to do this reminds the same as C(i-1). If i>a you could have an invalid string of 1's. To counter this, we call B(i-a-1) to know exactly how many sequences would be invalid if we 'append' a 1 at position i. When i=a+1, there's only one invalid string resulting of appending 1 at a+1, the sequence consisting of only 1's. B is analogous to A (calls A instead of B and uses b instead of a). Edited by author 12.07.2019 04:31 But how do we eliminate duplicates ? | | Test Case for WA #8 | Deepesson | 1104. Не спрашивай даму о возрасте | 20 янв 2021 00:06 | 1 | ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ Answer: 36 | | Подсказка | Nurs | 1709. Пингвин-Авиа | 19 янв 2021 14:54 | 1 | Подумайте о типе графа, дерево | | Wrong Answer... :( | Rafiqul Alam Chisty | 2012. Про Гришу Н. | 17 янв 2021 23:36 | 3 | #include <stdio.h> #include <math.h> int main() { int n; scanf("%d",&n); n=12-n; n>=7?printf("NO"):printf("YES"); return 0; } #include <stdio.h> int main(){ int n1,h,g; scanf ("%d",&n1); h=12-n1; g=h*45; if (g<=300){ printf ("YES");} else{ printf("NO");} return 0; }
/*In the name of Almighty Allah*/ #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; typedef vector<ll> vl; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef pair<int,int> pii; typedef pair<double, double> pdd; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; typedef set<int> si; typedef map<string,int> msi; typedef double dl; typedef string st; #define PB push_back #define F first #define S second #define MP make_pair #define endl '\n' #define all(a) (a).begin(),(a).end() #define sz(x) (int)x.size() #define mid(l,r) ((r+l)/2) #define left(node) (node*2) #define right(node) (node*2+1) #define mx_int_prime 999999937 #define CY cout<<"YES"<<endl #define CN cout<<"NO"<<endl #define rn return 0 const double PI = acos(-1); const double eps = 1e-9;//10^-9 const int inf = 2000000000; const ll infLL = 9000000000000000000; #define MOD 1000000007 #define PI 2*acos(0.0) #define mem(a,b) memset(a, b, sizeof(a) ) #define gcd(a,b) __gcd(a,b) #define sqr(a) ((a) * (a)) #define sw(a,b) swap(a,b) #define sor(a) sort(a.begin(),a.end()) #define sorr(a) sort(a.begin(),a.end(),greater<int>()) #define uni(s) unique(s.begin(),s.end())-s.begin() #define mxdex(a) max_element(v.begin(),v.end())-v.begin() #define mindex(a) min_element(v.begin(),v.end())-v.begin() #define mxele(a) max_element(v.begin(),v.end()) #define minele(a) min_element(v.begin(),v.end()) #define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define fraction(a) cout.unsetf(ios::floatfield); cout.precision(a); cout.setf(ios::fixed,ios::floatfield); #define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); typedef vector<int>::iterator vit; typedef set<int>::iterator sit; int dx[] = {0, 0, +1, -1}; int dy[] = {+1, -1, 0, 0}; //int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1}; //int dy[] = {0, +1, 0, -1, +1, -1, +1, -1}; //Debugger template < typename F, typename S > ostream& operator << ( ostream& os, const pair< F, S > & p ) { return os << "(" << p.first << ", " << p.second << ")"; } template < typename T > ostream &operator << ( ostream & os, const vector< T > &v ) { os << "{"; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << *it; } return os << "}"; } template < typename T > ostream &operator << ( ostream & os, const set< T > &v ) { os << "["; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << *it; } return os << "]"; } template < typename T > ostream &operator << ( ostream & os, const multiset< T > &v ) { os << "["; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << *it; } return os << "]"; } template < typename F, typename S > ostream &operator << ( ostream & os, const map< F, S > &v ) { os << "["; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << it -> first << " = " << it -> second ; } return os << "]"; } #define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0) void faltu () { cerr << endl; } template <typename T> void faltu( T a[], int n ) { for(int i = 0; i < n; ++i) cerr << a[i] << ' '; cerr << endl; } template <typename T, typename ... hello> void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); } int main() { optimize(); int f; cin>>f; int x=240/(12-f); if(x<45) CN; else CY; rn; } Edited by author 17.01.2021 23:37 | | hint | [MAI] do_v_5_strok | 1139. Городские кварталы | 17 янв 2021 21:06 | 1 | hint [MAI] do_v_5_strok 17 янв 2021 21:06 check the values of y[i] by x[i] - x[i-1] in the straight line equation > > > > > > > > use ceil() and floor() | | Problem statement clarification | Orfest (Novosibirsk SU) | 2017. Меньшее из зол | 17 янв 2021 16:10 | 1 | I'm confused by this sentence in the problem statement: "the murderers have agreed that their testimonies will have no contradictions between them" Does that mean that tests like this are invalid? 3 A 1 2 B 1 3 C 1 1 In this test there are 3 people and each one conflicts with at least one another. If one person is declared a murderer, there is still a contradiction between the other two. No 2 people can be declared murderers because there is always a contradiction between any 2 of them. | | Solution (SPOILER) | Alikhan Zimanov | 2116. Он вам не конь | 14 янв 2021 16:50 | 1 | Let's consider the case a = 0 and b = 0. Obviously, the answer will be n * n, because none of the knights will be able to move to any other cell of the table. Now let's assume that a != 0 or b != 0. By doing some casework, one can show that the answer for n will be the same as the answer for min(n, 10), so we can assume that n <= 10. Then, just find all possible night moves and get connected components of the corresponding graph. The answer will be the number of connected components. | | if WA3 | Programmer956 | 1131. Копирование | 13 янв 2021 09:49 | 2 | if WA3 Programmer956 3 апр 2020 21:49 if k > n my program worked with n < 0 you should to consider the case after cycle: if n < 0 then n = 0 Edited by author 03.04.2020 21:51 | | Who know how the 2nd test looks like?? | Last_Vikings | 1546. Сортировка по-японски | 12 янв 2021 22:29 | 18 | We cannot imagine the test where our prog will give wrong answer! I wonder too, always wa on test 2 1w1 01w01a Edited by author 24.04.2007 19:29 No, its not 2nd test. My prog correctly process it, but stil WA2. sorted: 01w01 01w1 01w01a z000 z00 z00p z0p and one more 0 0p 01 1 1p Edited by author 25.04.2007 20:03 Try this test: z0p z00pp z0pp z00pp00 z000pp01 z00pp01 z0pp01 z001pp00 z01pp00 z1pp00000 z01pp01 z1pp001pp0 z1pp01pp000 I get WA#2 too. Huge thanks to Alexander Kouprin, after running his test and solving the problem I got accepted. Test from Alexander Georgiev also helped me a lot. By the way, my program gives other output for some test from this thread. Here they are: abc00125a abc0125a abc00125b abc0125b abc000000000000000000000125a abc00000000000000000000125a abc0012000000000000000000000000005b abc012000000000000000000000000005b These tests have almost broken my mind while I have been thinking why they are correct and I'm happy that I do not have to fix my program because of them. Zeroes matters only if strings are equal. Try this: abc0125a abc00125a abc00125b abc0125b Try this: abc0125a abc00125a abc00125b abc0125b I suppose the last test by Peter Huggy is the most similar to second test but after all this tests WA6 Try this: abc00000000000000000000125a abc000000000000000000000125a abc0012000000000000000000000000005b abc012000000000000000000000000005b I suppose the last test by Peter Huggy is the most similar to second test but after all this tests WA6 Got AC, thanks to Alias tests :) You can also try: 0000000 000 (Already sorted) Your program must return for these tests next results (alredy sorted): 1) 000 00 0 2) 00 0 000a 3) 00a000 00a0 I don't understand this. Why is 0000000 smaller than 000? What's the logic behind it? Edited by author 12.01.2021 22:30 | | Why I get WA1(the result of my code is 3 4) | Ilya | 1079. Максимум | 12 янв 2021 20:50 | 2 | #include <bits/stdc++.h> using namespace std; int main(){ int n; int a[100000]; a[0] = 0; a[1] = 1; int max = 1; while(cin >> n, n != 0){ if(n > max){ for(int i = max + 1; i <= n; ++i){ if(i % 2 == 0){ a[i] = a[i / 2]; } else{ a[i] = a[(i - 1) / 2] + a[(i - 1) / 2 + 1]; } max = n; } } cout << a[n - (n % 2 == 0)] << "\n"; } } Edited by author 10.01.2021 03:55 print the maximum value in the range 1 to n a13 is greater than a15 |
|
|