| Show all threads Hide all threads Show all messages Hide all messages |
| ACCEPTED!!!! PASCAL SOLUTION | mNT | 1524. Men in Black | 1 Sep 2018 16:34 | 1 |
|
| test 3 | [TDUweAI] daminus | 1837. Isenbaev's Number | 1 Sep 2018 00:51 | 6 |
test 3 [TDUweAI] daminus 25 Jun 2013 19:21 input file: 1 Isenbae Isen Isenbaeva and, what what is your answer? Edited by author 25.06.2013 19:22 Edited by author 25.06.2013 19:22 Edited by author 25.06.2013 19:23 Isen undefined Isenbae undefined Isenbaeva undefined Love you bro <3 that me helped input file: 1 Isenbae Isen Isenbaeva and, what what is your answer? Edited by author 25.06.2013 19:22 Edited by author 25.06.2013 19:22 Edited by author 25.06.2013 19:23 Thanks a lot... :) I have been struggling hard to overcome WA 3 ... And this test helped me to pass WA-3. good hint for a beginners as me. It's better to be careful with reading a problem) |
| I got stuck in test 4, any idea? | phantomape | 1934. Black Spot | 31 Aug 2018 11:26 | 1 |
#include <iostream> #include <vector> #include <cstring> #include <queue> using namespace std; int N, M, S, T, A, B, P; int total = 0; struct Edge { int to, next; double prob; } edges[100010]; int head[100010]; int parent[100010], dist[100010]; double prob[100010]; void addEdge(int start, int end, int p) { edges[total].to = end; edges[total].next = head[start]; edges[total].prob = 1.0 - (double)p / 100.0; head[start] = total++; } // The most tricky part is the probability, we are looking for the probability // of meeting Kraken in any route so it should be P(A|B), which equals to // P(A) + P(B) - P(AB) int main() { memset(head, -1, sizeof head); memset(parent, -1, sizeof parent); memset(dist, -1, sizeof dist); cin >> N >> M >> S >> T; for (int i = 0; i <= N; i ++) prob[i] = 0.0; for (int i = 1; i <= M; i ++) { cin >> A >> B >> P; addEdge(A, B, P); addEdge(B, A, P); } queue<int> q; q.push(S); dist[S] = 0 ; prob[S] = 1.0; while (!q.empty()) { int u = q.front(); q.pop(); for (int idx = head[u]; idx != -1; idx = edges[idx].next) { int v = edges[idx].to; double p = edges[idx].prob; if (dist[v] == -1 || (dist[v] == dist[u] + 1 && prob[v] < prob[u] * p)) { if (dist[v] == -1) { q.push(v); } dist[v] = dist[u] + 1; prob[v] = prob[u] * p; parent[v] = u; } } } vector<int> path; for (int i = T; i != S; i = parent[i]) { path.push_back(i); } path.push_back(S); cout << path.size() << " "; printf("%.7f\n", 1.0 - prob[T]); for (int i = path.size() - 1; i >= 1; i --) cout << path[i] << " "; cout << path[0] << endl; return 0; } |
| useful test case!!!! | jlcastrillon | 1244. Gentlemen | 30 Aug 2018 18:19 | 7 |
5 4 1 3 6 1 answer:3 Edited by author 29.05.2011 11:06 thanks for your test, it helped me thanks ! Edited by author 18.04.2014 19:54 |
| Nice problem. | beastsl | 1037. Memory Management | 29 Aug 2018 22:24 | 1 |
Done with queue + segment tree, AC in 0.265 on Visual C++ 2017 |
| Could anyone help with Test 16? | Alflex | 1436. Billboard | 29 Aug 2018 19:38 | 2 |
I have WA, but I don't guess at the feature of this test. Does anyone have a problem with this test? Please comment your trick. You should be careful with the point (X, 0) that lies on line A + (B - A). The angle should be 0 there, but because of precision issues we all love this case can break ternary search. |
| AC in 6 line !!! | hoan | 1243. Divorce of the Seven Dwarfs | 29 Aug 2018 01:51 | 12 |
#include <cstdio> char ch, res; int main (){ while(scanf(" %c", &ch)!= EOF||(printf("%d\n", res)&0)) res= (res*10+ ch-'0')%7; } I'm too!!! import java.math.BigInteger; import java.util.Scanner; public class T_1243 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); BigInteger n = sc.nextBigInteger(); System.out.print(n.mod(new BigInteger("7"); )); }} public class Timus_1243 { public static void main(String[] args) { System.out.print(new java.util.Scanner(System.in).nextBigInteger().mod(java.math.BigInteger.valueOf(7))); } } you used long arithmetic, it is not best solution, read first post more accurately, it doesn't using any long arythmetic and arrays, collections, etc. I used the same algoritm! But on Pascal it takes a litle more lines(11 to be exact). But on Pascal my program works 0.015 seconds, but yours on C - 0.031 Edited by author 25.03.2011 22:55 My C solution works the same time as yours, but it used 104 КB memory instead of 154 КB in your case. #include <stdio.h> int main(void){ int c,a=0; for(;(c=getchar())!='\n';a=(a*10+c-'0')%7); printf("%u\n",a); return 0; } #include <iostream> int main(void){ int c,a=0; for(;(c=getchar())!='\n';a=(a*10+c-'0')%7); printf("%u\n",a); return 0; } 0.015s. Why does it work? I just don't understand the logic. AC in 2 lines: n = int(input()) print(n%7) Just 1 line :) print(int(input())%7) Edited by author 29.08.2018 01:51 |
| WA#1 TEST | TShT | 1102. Strange Dialog | 28 Aug 2018 23:32 | 1 |
outputon YES Edited by author 28.08.2018 23:32 |
| Small performance tip | Gilles Deleuze | 1912. Titan Ruins: Passing through Walls | 28 Aug 2018 20:44 | 1 |
Shortest path with respect to number of crossed walls is also shortest with respect to number of moves. Edited by author 28.08.2018 21:03 |
| WA3's people look here! | STK@fire | 1011. Conductors | 27 Aug 2018 11:28 | 1 |
less than can't be equal! |
| Help me find the bug | phyBoy | 1068. Sum | 27 Aug 2018 06:12 | 2 |
#include <stdio.h> int main () { int m ,i, sum; scanf("%d", &m); if(m >= 0){ sum = (m*(m+1))/2 ; printf("%d\n", sum); } else{ for(i=1, sum =0; i>=m; i-- ){ sum = sum+i; } printf("%d\n", sum); } return 0; } |
| Are the tests strong enough? | dntnhan | 1777. Anindilyakwa | 27 Aug 2018 01:56 | 2 |
I use unsigned long long and STL vector with very simple algorithm: store x1, x2, x3 in the vector, then find the minimal diffenrence and push it in the vector (repeat the process until minimal difference is 0). I got AC. I suppose that the tests are not strong enough. I wonder whether there is any test whose output is very large since I don's believe vector can store too many elements. P/S: I'm a beginner so I'm very glad to study from all of you :-)! The simulation works in O(logN), so your solution is correct |
| about memory(C : access violation) | AlbertLetry | 1001. Reverse Root | 26 Aug 2018 21:01 | 1 |
I use type[256*1024] int main(){ ... } run successfully . but use struct as int main() { type[256*1024] } get error : access violation and use type[256*1024 / sizeof(type)] get error : access violation what is the "A size of the input stream does not exceed 256 KB." means! |
| RTE #10 where am i wrong?? | thamizhkavingan | 1123. Salary | 25 Aug 2018 09:38 | 3 |
def chk(m): for i in range(0, int(len(m)/2)): if m[i] != m[len(m)-i-1]: if m[i] > m[len(m)-i-1]: m[len(m)-i-1] = m[i] else: m[len(m)-i-1] = m[i] m = inc(m, len(m)-i-2) chk(m) return m def inc(y, x): if y[x]<9: y[x] += 1 else: y[x] = 0 inc(y, x-1) return y v = list(input()) l = list(map(int, v)) if(len(v)==1): print(v[0]) else: l = chk(l) print("".join(str(o) for o in l)) I thought index reaching end may be a problem but that can never happen can it?, TLE may be ok but why RTE??? It is because of too many recursion i presume trying to find a work around... def chk(m): for i in range(0, int(len(m)/2)): if m[i] != m[len(m)-i-1]: if m[i] > m[len(m)-i-1]: m[len(m)-i-1] = m[i] else: m[len(m)-i-1] = m[i] m = inc(m, len(m)-i-2) chk(m) return m def inc(y, x): if y[x]<9: y[x] += 1 else: y[x] = 0 inc(y, x-1) return y v = list(input()) l = list(map(int, v)) if(len(v)==1): print(v[0]) else: l = chk(l) print("".join(str(o) for o in l)) |
| WA1 | smmac72 [ 🐊] | 1404. Easy to Hack! | 25 Aug 2018 05:59 | 1 |
WA1 smmac72 [ 🐊] 25 Aug 2018 05:59 I tried to do it with char input, the same happens. tested everything I could find, but passed all the tests don't know what to do #include <iostream> #include <string> using namespace std; int main() { string alf = "abcdefghijklmnopqrstuvwxyz"; char alp[26] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; string inp; cin >> inp; short *arr = new short[inp.length()]; short *out = new short[inp.length()]; short prev = 0; for (short i = 0; i < inp.length(); i++) { short num = alf.find(inp[i]) + 1; if (num <= 5) num += 26; while (arr[i - 1] > num) num += 26; arr[i] = --num; } out[0] = arr[0] - 5; for (short i = 1; i < inp.length(); i++) out[i] = arr[i] - arr[i - 1]; for (int i = 0; i < inp.length(); i++) cout << alf[out[i]]; delete[] arr; delete[] out; return 0; } |
| What are fuck????? | pizdec | 2036. Intersect Until You're Sick of It | 25 Aug 2018 03:49 | 2 |
I use about 3*n operations but TL81 or TL84!!! I got TL because I used map(int, input().split()) Edited by author 22.08.2018 00:07 But you used Python. Get used to it. |
| Intended solution | Djok216 [Clown Fiesta] | 1764. Transsib | 24 Aug 2018 22:11 | 1 |
What is the intended solution for this problem? I used simulated annealing in order to get AC, but I don't think this is intended to pass. |
| nice tests | IlushaMax | 1786. Sandro's Biography | 23 Aug 2018 22:51 | 2 |
|
| WA 14. Plz help! | IPRIT | 1000. A+B Problem | 23 Aug 2018 21:52 | 5 |
I get WA on 14 test. Please give me tests! Try with this: 2147000000 -2147000000 Output should be: 0 |
| WA on test 2!!! Please help!!! | Quzar | 1235. Cricket Field | 23 Aug 2018 18:01 | 4 |
i have WA#4 and this test help me: input: 2 5 4 1 2 4 2 output: 1 1 3 GOOD LUCK!!! or 1 0 3 It's rigtht too Edited by author 18.08.2014 22:09 Edited by author 18.08.2014 22:09 Tests #2 and #3 have N = 0, with a square board on second and rectangular on the third one. By the way, if anyone wants a challenge: Solve this problem in NLogN time and linear memory with scanline. |