Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Input issues | irkstepanov | 1006. Квадратные рамки | 28 июн 2025 15:31 | 1 |
To read the input in C++, the following helped me: unsigned char x = cin.get(). Then I used some ifs in the form of if (x == 218) { ... } Also, the first test case seems to be different from the one suggested in the statement. |
I WA 10# | 1898098 | 1002. Телефонные номера | 27 июн 2025 19:07 | 2 |
same. My previous solution was dfs approach, and it is too slow, since it is completely full bruteforce. However, I came up with dfs approach optimization. And here I am with WA 8# :) I have absolute no idea what is wrong. |
wa3 idk why, python | nekrip | 1297. Палиндромы | 26 июн 2025 03:00 | 1 |
b = input() s = '' d = [] for i in b: s += i if s == s[::-1]: d.append(s) if s != s[::-1] and len(s) % 2 != 0: s = s[1:] if s == s[::-1]: d.append(s) if s != s[::-1] and len(s) % 2 != 0: s = s[1:] m = max(d, key=len) if len(m) <= 1000: print(m) |
if you have WA | pon | 1192. Мячик во сне | 16 июн 2025 16:39 | 1 |
see what your program outputs for an integer answer ps it should output .00 посмотрите, что выводит ваша программа при целом ответе ps она должна выводить .00 |
some tests | Felix_Mate | 1905. Путешествия во времени | 14 июн 2025 15:53 | 2 |
1) 4 4 1 2 9 15 1 4 0 8 2 3 20 30 3 1 31 0 1 4 9 30 -> 4 1 3 4 2 2) 2 3 1 2 0 5 1 1 110 80 1 1 90 0 1 2 100 6 -> 3 2 3 1 3) 3 6 1 2 50 55 2 1 55 40 1 2 0 1 1 3 41 80 3 2 80 12 2 1 15 0 1 2 49 7 -> 6 1 2 4 5 6 3 n= ; k= ; m=n*k <=100000 ------------------------ n m 1 2 1 1 1 2 2 2 ....... 1 2 k k 2 3 1 1 2 3 2 2 ....... 2 3 k k ....... ....... ....... n 1 1 0 n 1 2 1 n 1 3 2 ....... n 1 k k-1 1 1 k 0 --------------------------- for n=3, k=2 Ans. 2 4 6 1 3 5 |
What algo? | bsu.mmf.team | 1842. Локальные корни | 10 июн 2025 22:26 | 7 |
Finally I've solved this problem using very hard optimised Main & Lorentz's algo, and 0.405s only. But I noticed many people solved this problem very fast and using much less memory. What algo do you use? I doubt it's possible to speed-up Main & Lorentz or Crochemore algos so much. Is it some alternative (like suffix tree) solution, or just some strong idea can be applied to this particular problem? Is it possible to solve it in O(n)? I use something similar with manacher algorithm with some optimization.. I use this approach: first for every position find the answer which cover outside the string(using kmp algo) as estimate value, and sort the estimate value in desending order, then use bruteforce(hash+enum) to calc the answer inside the string.when estimate value <=ans break; this program make me 0.2s AC... Thank you, but your solution is either not very fast :) I believe there's a strict approach exists with a strict algo for this problem. My algorithm is similar to Shen Yang.But I also use exkmp to calc another two situaion. Then the estimate value will become smaller.I got AC in 0.046s. Look up Critical Factorization Theorem Lookup Two Way algorithm for finding critical position of string. Second number is period of the string. |
WA 17 | наФуллФокусе | 1035. Вышивка крестиком | 10 июн 2025 22:08 | 1 |
WA 17 наФуллФокусе 10 июн 2025 22:08 |
Brute force Accept in 1.625 | zser | 1044. Счастливые билеты. Easy! | 8 июн 2025 20:41 | 1 |
#include <bits/stdc++.h> using namespace std; int cal(int x){ int ret = 0; while (x > 0){ ret += x % 10; x /= 10; } return ret; } bool lucky(int x, int mm){ int a = x / mm; int b = x % mm; if (cal(a) == cal(b)) return true; return false; } int main(){ int n; cin >> n; int nn = round(pow(10, n)) - 1; int mm = round(pow(10, n / 2)); int tot = 0; for (int i = 0; i <= nn; i++){ if (lucky(i, mm)) tot++; } cout << tot << endl; } if your code is simple and fast enough, brute force can work. |
why I get WA at test 8. | Mahdi Hasan Qurishi | 1036. Счастливые билеты | 6 июн 2025 01:24 | 1 |
what is wrong with my code: #include <iostream> #include <algorithm> #include <climits> #include <string> #include <cstring> #include <cmath> #include <vector> #include <stack> #include <map> #include <set> #include <iomanip> #include <unordered_map> #define ll long long #define fri(a, b) for (ll i = a; i < b; i++) #define frj(a, b) for (ll j = a; j < b; j++) #define frk(a, b) for (int k = a; k < b; k++) #define frh(a, b) for (int h = a; h < b; h++) #define frz(a, b) for (int z = a; z < b; z++) #define rfri(a, b) for (int i = a; i >= b; i--) #define rfrj(a, b) for (int j = a; j >= b; j--) #define yes cout << "YES" << "\n"; #define no cout << "NO" << "\n"; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); const int mod=100000007; using namespace std; ll dp[50][1005]; ll func(ll n,ll s){ if(dp[n][s] != -1) return dp[n][s]; if(s == 0) return 1; if(n == 0){ if(s == 0) return 1; else return 0; } ll ans = 0; fri(0,10){ if((s - i) >= 0) ans = (ans + func(n-1,s-i)) ; } return dp[n][s] = ans; } int main() { fast ll T = 1; // cin >> T; frz(0,T){ ll n,s; cin >> n >> s; memset(dp,-1,sizeof(dp)); if(s%2) cout << 0 << "\n"; else { ll ans = func(n,s/2); cout << (ans*ans) << "\n"; } } } |
Tests incorrect | Лукьянчиков Владимир Игоревич | 1369. Тараканьи бега | 5 июн 2025 17:34 | 1 |
For example: 16 9001 9001 8999 8999 9001 8999 8999 9001 -9001 -9001 -9001 -8999 -8999 -9001 -8999 -8999 9001 -9001 8999 -8999 9001 -8999 8999 -9001 -9001 9001 -8999 8999 -9001 8999 -8999 9001 5 9000 9000 9000 -9000 -9000 -9000 -9000 9000 0 0 My AC program gives answer: 1 2 3 4 9 10 11 12 5 6 7 8 13 14 15 16 2 But right answer: 1 2 3 4 9 10 11 12 5 6 7 8 13 14 15 16 2 8 10 14 |
Java BIT gets TLE, C++ AC ? | begi | 1028. Звёзды | 4 июн 2025 20:22 | 4 |
First I wrote the program in Java, but I got TLE on test #9, below is my program that gets TLE: import java.util.Scanner; public class Main {
public static int read(int idx, int[] tree){ int sum = 0; while(idx > 0){ sum += tree[idx]; idx -= idx & (-idx); } return sum; }
public static void update(int idx, int maxIndex, int[] tree){ while(idx <= maxIndex){ tree[idx]++; idx += idx & (-idx); } }
public static void main(String[] args) { int N; int maxIndex = 32005;
int[] level; int[] binaryIndexTree;
Scanner sc = new Scanner(System.in); N = sc.nextInt(); level = new int[N+1]; binaryIndexTree = new int[maxIndex];
for(int i=0; i<N; i++){ int x = sc.nextInt(); int y = sc.nextInt(); x++; level[ read(x, binaryIndexTree) ]++; update(x, maxIndex, binaryIndexTree); } for(int i=0; i<N; i++){ System.out.println(level[i]); } } } Then I write in C++ and get AC? @admins: Please extend time limit for Java. In Java, Scanner for input consumes extra time, so TLE. Using BufferedReader for input may help. I had the same issue and managed to bypass it with submitting the same solution 3 times in a row. I got TLE9, TLE11 and finally AC. My guess it is because of JIT compiler optimizations. |
Soo the problem is only math. | Shomik Shahriar | 1209. 1, 10, 100, 1000... | 29 май 2025 06:55 | 2 |
I tried with precalculating with map for setting up the index with 1 only rest will be auto 0 but miraculously WA at 4. so i figured out that the author only wants you to solve with his idea only. So good luck. These problems are trivial once you start thinking about things algebraically. The author made the constraints the way they are to try to force you in that direction as its an educational problem. |
To ADMIN add test, because tests are weak | coder | 2175. Лестница | 25 май 2025 13:20 | 1 |
Hi, Admins. Please, add these case: N > 5*10^4 a[i] = 1, for i = 1.. N-1, and a[N] = 10^9 Q = N p[i] = i, x[i] = i For example: 77888 1 1 1 1 1 1 .... 1 1 77888 77888 1 1 2 2 3 3 4 4 5 5 ... 77888 77888 |
0.031 seconds )) | coder | 2175. Лестница | 24 май 2025 21:58 | 1 |
my solution takes 0.031 seconds. |
I don't understand the question. Help !! | Rithik Linkon Penaru | 1083. Факториалы!!! | 12 май 2025 10:33 | 2 |
Can Anyone be kind enough to explain this ques to me? I'll be grateful to you.. You need to calculate factorial form n upto k or n mod k depending on divisibility, by following this pattern (n-0*k)*(n-1*k)*.....*k or n mod k. |
For those dude who thinks sieve is only option | Shomik Shahriar | 1086. Криптография | 11 май 2025 11:57 | 1 |
DO your own solve then check this do not cheat yourself #include<bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define FastAF ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); template <typename T> // cin >> vector<T> istream &operator>>(istream &istream, vector<T> &v){for (auto &it : v) cin >> it;return istream;} template <typename T> // cout << vector<T> ostream &operator<<(ostream &ostream, const vector<T> &c){for (auto &it : c) cout << it << " ";return ostream;} const int mx=2e5; int ar[mx]; void d(){ ar[0]=2; int k=1; for(int i=3;i<mx;i++){ bool f=true; for(int j=2;j*j<=i;j++){ if(i%j==0){ f=false; break; } } if(f){ ar[k++]=i; } } } int main(){ FastAF d(); int n; cin>>n; while(n--){ int a;cin>>a; cout<<ar[--a]<<endl; } return 0; } Algo: sqrt with precomputation Edited by author 11.05.2025 11:58 Edited by author 11.05.2025 12:02 |
Test 7 contains intersecting squares which contradicts the statement | bidzilya | 1097. Квадратная страна 2 | 10 май 2025 20:01 | 1 |
|
WA 55 | наФуллФокусе | 2184. Любимое число Флинта | 9 май 2025 02:32 | 1 |
WA 55 наФуллФокусе 9 май 2025 02:32 |
nice test | 👑TIMOFEY👑`~ | 1762. Поиски тайника | 3 май 2025 17:37 | 1 |
|
ests | andreyDagger`~ | 1464. Освещение | 1 май 2025 03:48 | 1 |
ests andreyDagger`~ 1 май 2025 03:48 0 0 16 1 1 2 1 2 0 3 0 3 1 2 2 3 2 4 1 4 3 0 3 0 4 1 4 1 5 -1 5 -1 -1 1 -1 12.00000000000000000000 0 0 5 -1 -1 1 0 0 -1 2 -2 2 4 5.50000000000000000000 0 0 17 -1 -1 5 -1 1 0 1 1 2 2 2 1 3 1 3 3 4 4 4 3 5 3 5 5 0 5 0 6 6 6 6 7 -1 7 24.00000000000000000000 0 0 4 0 -1 1 0 0 1 -1 0 2.00000000000000000000 0 0 4 -1 2 -1 -1 1 0 3 -1 3.6666666666 0 0 3 -1 -1 1 -1 0 1 2.00000000000000000000 0 0 11 0 -1 3 0 2 2 1 1 2 3 0 4 0 3 -1 5 -2 3 0 2 -1 0 10.50000000000000000000 |