| Show all threads Hide all threads Show all messages Hide all messages |
| Why WA?Who can help me? | Frank | 2011. Long Statement | 11 May 2017 12:16 | 2 |
int main(int argc,char *argv[]){ //freopen("data.txt","r",stdin); int n,i,key = 0,count = 0; char p[105],input[105]; scanf("%d",&n); getchar(); for(i = 0; i < n; i++){ scanf("%c",&input[i]); getchar(); } input[i] = '\0'; strcpy(p,input); while(next_permutation(p,p+n)){ if(strcmp(p,input) == 0){ break; } else { count++; if(count >= 5){ printf("Yes\n"); return 0; } } } if(count >= 5){ printf("Yes\n"); } else { printf("No\n"); } } count should be at least 6 :) |
| WA on #8 | Sarvagya Agarwal | 1244. Gentlemen | 11 May 2017 11:04 | 2 |
WA on #8 Sarvagya Agarwal 23 Jan 2017 01:04 /* ye mera template hai apna khud likho bc :P */ /* Author : Sarvagya Agarwal */ #include<bits/stdc++.h> using namespace std; //defines #define openin freopen("input.txt","r",stdin) #define openout freopen("output.txt","w",stdout) #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define ll long long #define int long long #define mod 1000000007 #define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--) #define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++) #define all(c) (c).begin(),(c).end() #define ff first #define ss second #define pb push_back #define mp make_pair /* Print pair */ template <typename T,typename S> ostream & operator << (ostream &os , const pair<T,S> &v) { os << "(" ; os << v.first << "," << v.second << ")" ; return os ; } /* Print vector */ template <typename T> ostream & operator << (ostream &os , const vector<T> &v) { os << "[" ; int sz = v.size() ; for(int i = 0 ; i < sz ; ++i) { os << v[i] ; if(i!=sz-1)os << "," ; } os << "]\n" ; return os ; } /* Print set */ template <typename T> ostream & operator << (ostream &os , const set<T> &v) { T last = *v.rbegin() ; os << "[" ; for(auto it : v) { os << it ; if(it != last) os << "," ; } os << "]\n" ; return os ; } /* Print Map */ template <typename T,typename S> ostream & operator << (ostream &os , const map<T,S> &v) { for(auto it : v) { os << it.first << " : " << it.second << "\n" ; } return os ; } int power(int a , int b) { int res = 1 ; while(b) { if(b%2) { res = (res * a) % mod ; } b/=2 ; a = (a*a) % mod ; } return res ; } //debug #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); } #else #define trace(...) #endif int sum , n , arr[105] ; int dp[105][1005] ; int ans[105] ; int solve(int index,int weight) { if(weight == 0) { // found a configuration return 1 ; } if(index > n) { return 0 ; } int &res = dp[index][weight] ; if(res != -1) return res ; res = 0 ; res += solve(index + 1 , weight) ; if(arr[index] <= weight)res += solve(index + 1 , weight - arr[index] ) ; return res ; } void go(int index, int weight) { if(index > n || weight == 0) return ; // can you take this ? if(arr[index] <= weight && solve(index + 1 , weight - arr[index]) == 1) { ans[index] = 1 ; go(index + 1 , weight - arr[index] ) ; return ; } go(index + 1 , weight) ; return ; } int32_t main() { fast; cin >> sum >> n ; rep(i,1,n) { cin >> arr[i] ; } memset(dp,-1,sizeof(dp)) ; int res = solve(1,sum) ; if(res == 0) { cout << res ; return 0 ; } if(res > 1) { cout << -1 ; return 0 ; } go(1,sum) ; for(int i = 1 ; i <= n ; ++i) { if(ans[i] == 0) { cout << i << " " ; } } return 0; } 4950 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 4951 ans = 100 Edited by author 11.05.2017 11:05 |
| It may be useful: (if You use Dynamic Programming), increasing percentage doesn't exceed 100% | Pasha | 1138. Integer Percentage | 11 May 2017 02:05 | 3 |
Simply use DP with Recurse and You'll get AC! not to much to prove, suppose we have dp[x] where x is an integer number beetwen s and n, we calculate the numbers wich are integer percent of x. for example y is a number wich is an integer percent of x like(y = x*(50/100)), the reccurence is dp[x] = max(dp[x], dp[y] + 1) among all y which are integer percent |
| what is test#1?? | Xiaohan Yu | 1150. Page Numbers | 10 May 2017 22:47 | 2 |
here is my code im getting test# 1 WA btw im using python 2.7 import sys print sys.argv pages = raw_input() pages = int(pages) nums = [0]*10 def countingNums(pages): global nums if pages == 0: return "" else: sPages = str(pages) for i in range(len(sPages)): nums[int(sPages[i])] += 1 return countingNums(pages-1) countingNums(pages) for i in range(len(nums)): print nums[i] Edited by author 10.05.2017 17:30 Test #1 answer is 1 5 2 (7)1 |
| So nice story | Mahilewets | 1351. Good Gnusmas – Dead Gnusmas | 10 May 2017 14:23 | 2 |
[code deleted] My first submit got WA#8, my second WA#9, my third got WA#10 of course. I am going so straight, so incrementally. Maybe author made tests in such an amazing increasing-difficulty way. Edited by moderator 03.12.2019 21:46 I was so stupid not to check the distance in case when arc of fire is zero degrees and gnusmas is on the line. |
| Your checker increase work time of my program | IlushaMax | 1012. K-based Numbers. Version 2 | 9 May 2017 17:55 | 2 |
I compiled my code on ideone and there I have 0.4 sec for test 1800 10 So I have tle 9. Maybe there are stronger tests? By the way my program use vectors in long arithmetics. Should I use strings in it? Edited by author 08.05.2017 22:14 My solution in Python 3.4 solves the problem in 78 milliseconds. I do not use binary power. |
| RE4(Access Violation) | Vova | 1658. Sum of Digits | 9 May 2017 13:10 | 3 |
WTF?! I have RE4(Access Violation). I don't understand why? You only need DP[8100][900] or DP[900][8100] instead of DP[10000][10000] |
| hint | Connector | 1753. Bookshelf | 9 May 2017 02:36 | 5 |
hint Connector 17 Mar 2010 21:47 Re: hint [SSAU] Igor Shamashov 24 Mar 2010 22:58 Simple math problem. You should just maximise one function. Unfortunately, I don't know how to maximize it. So I can search :) H/2*sin(a) - h*tan(a) Can anybody tell me how to maximize it? Oh, I recalled my differential calculus. how you got h*tan(a) in your formula ??? why it works ?? As of the definition of the tangent, there must be h/tan(a) but this gives wroung results ! why ? |
| I am really poor | Mahilewets | 1627. Join | 8 May 2017 19:38 | 8 |
So, I just wrote solution with C long double and got WA #5 (Laplacian). Then I just rewrote it in Python with decimal.py and got WA...#3! Then I started to add more precision to decimal and got TLE #3. Yeah, I use some epsilon constant and add it to determinant before convert determinant to integer and get its modulo 10**9. Lol FINALLY understand I should just made M[row] [col] =LCM Yeah! I tried this: 3 3 *** *.* *** And got zero, not one! Should correct... WA #8. I am really frustrated. http://ideone.com/7nPKN0 That time without fractions. Used decimal with 1450 digits after point. Edited by author 08.05.2017 18:47I realized I need not determinant of a whole matrix but just a minor. http://ideone.com/5H6ARHSubmitted corrected solution with Fractions. Buuut!! WA #8 still... |
| Why is this crashing to WA#1 (Python)? | Kasparow | 1226. esreveR redrO | 8 May 2017 18:46 | 1 |
import sys def reverse(i): if len(i) == 1: return i else: return i[len(i)-1]+reverse(i[:len(i)-1]) def getReverseLine(s): start = 0 for i in range(len(s)): if (ord(s[i]) < 123 and ord(s[i]) > 64) and (ord(s[i]) < 91 or ord(s[i]) > 96): if i == len(s)-1: if start < i: s = s.replace(s[start:i+1], reverse(s[start:i+1])) else: if start < i: s = s.replace(s[start:i], reverse(s[start:i])) start = i+1 else: start += 1 return s lines = [] while True: line = sys.stdin.read() if line == '': break lines.append(getReverseLine(line)) text = '\n'.join(lines) print text |
| WA#2 | So Sui Ming | 1137. Bus Routes | 8 May 2017 12:50 | 1 |
WA#2 So Sui Ming 8 May 2017 12:50 3 6 1 2 5 7 5 2 1 4 1 4 7 4 1 5 2 3 6 5 4 2 my solution: 15 2 5 7 5 2 1 2 3 6 5 4 7 4 1 4 2 2 4 1 2 3 4 1 4 1 2 3 4 1 my solution: 4 1 2 3 4 1 4 1 1 1 1 1 1 1 1 1 1 1 1 my solution: 1 1 1 Are there any test cases for debugging? |
| Why WA?Here is my program can anybody help me :( | mariam kupatadze | 1164. Fillword | 6 May 2017 22:33 | 2 |
Here is my program,I have taken WA on the test of 2, I think it is correct,please tell me what is wrong,please if you can.. program fillword; var a:array[1..10] of string; b,k:array[1..100] of string; i,j,n,m,p,t:integer; ch:char; l,r:string; begin read(n,m,p); readln; for i:=1 to n do readln(a[i]); for j:=1 to p do readln(b[j]); for i:=1 to p do for j:=1 to n do if b[i]=a[j] then begin t:=t+1; k[t]:=b[i]; break; end; for i:=1 to t do begin r:=''; l:=k[i]; for ch:='A' to 'Z' do for j:=1 to m do if ch=l[j] then r:=r+ch; writeln(r); end; end. 9 years later... >for i:=1 to p do > for j:=1 to n do I suppose, it shouldn't be to p... |
| Several data to KILL your program with PRECISION problems. | 198808xc | 1265. Mirror | 4 May 2017 17:37 | 4 |
BTW: I have used self-implemented high-precision longint to solve this problem. 1000 0 0 -1000 0 0 1000 1000 VISIBLE 1000 -0.000001 0 -1000 0 0 1000 1000 INVISIBLE 1000 0 -0.000001 -1000 0 0 1000 1000 INVISIBLE 1000 0 0.000001 -1000 0 0 1000 1000 VISIBLE 1000 -0.000001 0.000001 -1000 0 0 1000 1000 VISIBLE 1000 -1000 999.999999 -1000 0 0 1000 1000 INVISIBLE 1000 -1000 999.999999 -999.999999 0 0 1000 1000 VISIBLE -999.999999 -1000 1000 999.999999 0 0 1000 1000 VISIBLE 1 2 1 0 0 0 0 1 VISIBLE 1.000001 2 1 0 0 0 0 1 VISIBLE 0.999999 2 1 0 0 0 0 1 INVISIBLE 1000 0 1000 -0.000001 0 0 0.000001 1000 VISIBLE 1000 0 1000 -0.000002 0 0 0.000001 1000 VISIBLE 1000 0 1000 -0.000003 0 0 0.000001 1000 INVISIBLE 2 more test which help me get AC, I fails on checking that both points on 1 side of line. 40 60 59 40 50 30 90 70 VISIBLE 40 60 61 40 50 30 90 70 INVISIBLE |
| Why WA 1#? | ananimus_vs16 | 1601. AntiCAPS | 3 May 2017 16:32 | 1 |
var s: array[1..50] of string; si, i1, i, c: integer; input, output: text; begin {$IFNDEF ONLINE_JUDGE} assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); {$ENDIF} while not seekeof(input) do begin inc(si); read(input, s[si]); end; c := 1; for i := 1 to si do for i1 := 1 to length(s[i]) do begin if c = 0 then s[i][i1] := lowercase(s[i][i1]); if (c = 1) and (s[i][i1] <> ' ') and (s[i][i1] <> '-') and (s[i][i1] <> ':') then c := 0; if (s[i][i1] = '?') or (s[i][i1] = '.') or (s[i][i1] = '!') then c := 1; end;
for i := 1 to si do writeln(output, s[i]); {$IFNDEF ONLINE_JUDGE} close(input); close(output); {$ENDIF} end. |
| really don't understand how somebody got AC in 0.001s | Ade | 1102. Strange Dialog | 2 May 2017 12:16 | 2 |
Maybe finite state automation. |
| hint | Mostafa Tantawy | 1319. Hotel | 29 Apr 2017 21:48 | 1 |
hint Mostafa Tantawy 29 Apr 2017 21:48 divide the matrex into three divisions >> above the diagonal >>> the diagonal>>under the diagonal simulate more than matrix for insure your answer |
| How to solve this problem in Python 3.4? | JuliM | 1100. Final Standings | 29 Apr 2017 14:28 | 3 |
All mentioned solutions cause TLE. I have got "accepted" on python 2.7 even with very ineffective variant, and python 3.4 always writes TLE ?????? I have same problem! This solution difficult is O(n), but i got TLE #11 [code cuted] I send this code with python 2.7 and got AC with time 0.67. lol) Edited by author 30.04.2017 12:38 |
| У меня все верно, на сервере WA1. Как так? | MNaz | 1100. Final Standings | 29 Apr 2017 14:26 | 5 |
Нашел ошибку. =) Edited by author 12.05.2014 09:33 То же самое у меня, WA1 и все тут, хотя у меня нормально проходило и другие тесты. Вчем была ошибка ? I have WA1 too, i cant understand why, because example from briefing was ok. Python code: from sys import stdin, stdout N = int(stdin.readline()) D = {} for i in range(N): inp = stdin.readline().split(' ') D[inp[0]]=int(inp[1])
for tup in sorted(D.items(), key=lambda x: x[1], reverse=True): print(tup[0], tup[1]) In that problem the solution is a STABLE sort. В этой задаче решением является УСТОЙЧИВАЯ сортировка. Спасибо за ответ! Не понял этого из описания задачи |
| Someone just answer "yes" or "no"...... | Jaideva | 1577. E-mail | 28 Apr 2017 23:02 | 2 |
Is this a problem for counting the number of shortest common superstrings ??? |
| Try to use Python2.7 if you have Python3.4 TLE | Mahilewets | 1246. Tethered Dog | 28 Apr 2017 17:04 | 1 |
Python3: TLE #8 Python2: AC 0.8 sec Code is the same. (Pseudo-vector product) Edited by author 28.04.2017 17:08 |