Show all threads Hide all threads Show all messages Hide all messages |
why I get WA at test 8. | Mahdi Hasan Qurishi | 1036. Lucky Tickets | 6 Jun 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. Cockroach Race | 5 Jun 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. Stars | 4 Jun 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. |
0.031 seconds )) | coder | 2175. Staircase | 24 May 2025 21:58 | 1 |
my solution takes 0.031 seconds. |
I don't understand the question. Help !! | Rithik Linkon Penaru | 1083. Factorials!!! | 12 May 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. Cryptography | 11 May 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 |
WA 55 | наФуллФокусе | 2184. Flint's Favorite Number | 9 May 2025 02:32 | 1 |
WA 55 наФуллФокусе 9 May 2025 02:32 |
nice test | 👑TIMOFEY👑`~ | 1762. Search for a Hiding-Place | 3 May 2025 17:37 | 1 |
|
ests | andreyDagger`~ | 1464. Light | 1 May 2025 03:48 | 1 |
ests andreyDagger`~ 1 May 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 |
hint please | sailingoat | 2041. Nanomatryoshkas | 29 Apr 2025 21:03 | 1 |
I would appreciate hints(or solution) a lot! Please e-mail me at addflash@dmc.chat |
Question about sample | ConnorChang | 1143. Electric Path | 28 Apr 2025 05:03 | 1 |
Why is the sample 50.211, shouldn't the sample be 50.198 because the path (45, 0) -> (50, 1) -> (5, 1) -> (0, 0) is length 50.198? |
I am curious | andreyDagger`~ | 2053. Biology | 25 Apr 2025 01:41 | 1 |
Is there some constructive approach? I solved it with some tricky bruteforce with optimizations |
wa 6 | 👑TIMOFEY👑`~ | 2174. Dualism of Numbers | 24 Apr 2025 18:22 | 1 |
wa 6 👑TIMOFEY👑`~ 24 Apr 2025 18:22 |
hint | LeTim | 1465. Pawn Game | 24 Apr 2025 15:07 | 1 |
hint LeTim 24 Apr 2025 15:07 find out how to solve the problem for n <= 68. for bigger n just do n = (n - 35) % 34 + 35 and solve the problem for this n. |
bad constraints | LeTim | 2047. Maths | 23 Apr 2025 15:41 | 1 |
i think the memory limit should be higher |
Язык отправки | DrugovaAleksandraVasilievna | 1275. Knights of the Round Table | 21 Apr 2025 22:34 | 1 |
Отсутствует язык отправки C# |
easy bfs | 👑TIMOFEY👑`~ | 1774. Barber of the Army of Mages | 19 Apr 2025 17:54 | 2 |
this is a very cool task, it requires a little out-of-the-box thinking, I really liked it |
WA 12 test | Alikhan Zimanov | 1966. Cycling Roads | 19 Apr 2025 17:19 | 2 |
Input: 4 2 1 1 5 3 7 -1 4 7 1 2 3 4 Correct output: NO One of the reasons of "WA" might be that your solution incorrectly determines whether two segments intersect or not. Edited by author 11.04.2020 15:09 |
If you wa on test 19 | vectorlmn | 1739. Faryuks | 17 Apr 2025 17:15 | 1 |
Maybe you output multiple answers. Reason: after output a correct answer,the program should be exit,but you may not do that. (I'm sorry for my bad English) |
some tests | LeTim | 1519. Formula 1 | 17 Apr 2025 15:07 | 1 |
Input 2 2 .. .. Output 1 Input 12 12 ************ ************ ************ ******..**** ******..**** ************ ************ ************ ************ ************ ************ ************ Output 1 Input 2 4 .... **** Output 0 Input 4 2 .* .* .* .* Output 0 Input 2 5 ..*.. ..*.. Output 0 Input 5 2 .. .. ** .. .. Output 0 Input 12 12 ............ ............ ............ ............ ............ ............ ............ ............ ............ ............ ............ ...........* Output 0 Input 6 6 ...... ...... ..**.. ..**.. ...... ...... Output 14 Input 6 6 ...... ...... ...... ...... ...... ...... Output 1072 Input 12 12 ............ ............ ............ ............ ............ ............ ............ ............ ............ ............ ............ ............ Output 1076226888605605706 |