Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | WA8 | [ITMO] Semyon Stepanov | 1237. Evacuation Plan | 10 июн 2018 09:44 | 1 | WA8 [ITMO] Semyon Stepanov 10 июн 2018 09:44 I always have WA8, can you give me some tips about this test? | | Решение C# | Solution C# | Viktor | 1000. A+B Problem | 10 июн 2018 01:46 | 2 | using System; namespace t1000{ class Program{ public static void Main(string[] args){ string[] s = Console.ReadLine().Split(' '); Console.WriteLine(int.Parse(s[0]) + int.Parse(s[1])); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 {
class Program { static void Main(string[] args) { int a, b; a=Convert.ToInt32(Console.ReadLine()); b = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(a + b);
} } } Why my method is incorrect? | | The dice sides 2, 3 and 6 are (probably) not symmetrical. | Alexander Vasilyev`~ | 1015. Найдите различия! | 9 июн 2018 22:33 | 1 | It must be mentioned that two dice are considered equal if the numbers of points on corresponding faces are equal regardless of the orientation of the points on each face. For example, if you superimpose two dice and the numbers of points coincide but two corresponding faces look like this: #.. ..# .#. and .#. ..# #.. then the dice have the same schemes. Edited by author 09.06.2018 22:36 | | String takes 1 space count extra when input is !!. Please help me out | Saurav Jaiswal | 1083. Факториалы!!! | 9 июн 2018 19:53 | 1 | import java.util.*; import java.lang.*; public class Factorial{ public static void main(String[] args){ Scanner cin=new Scanner(System.in); int n=Integer.parseInt(cin.next()); String k=cin.nextLine(); int j=k.length()-1; int sum=1; for(int i=n;i>0;i-=j){ sum=sum*i; } System.out.println(sum); } } | | Why wrong answer ? | Logerator | 1068. Сумма | 9 июн 2018 19:23 | 1 | #include <stdio.h> void main() { int N,i,sum; sum = 0; scanf_s("%d", &N); if (N < 0) { for (i = N; i < 2; i++) { sum = sum + i; } } else { for (i = N; i > 0; i--) { sum = sum + i; } } printf("%d", sum);
} | | Help | Evgeniy | 1989. Подпалиндромы | 9 июн 2018 16:44 | 1 | Help Evgeniy 9 июн 2018 16:44 I cant understand my mistake for TLE14. My code var s,s1,s2: string; z2,z1,a,i,f,p,code: integer;z,n:int64; ch:char; begin readln(s); readln(npalindrome? 1 100000); for i:=1 to n do begin readln(s2); if s2[1]='p' then begin a:=13;z1:=0;z2:=0; while s2[a]<>' ' do inc(a); val(copy(s2,13,a-13),z1,code); val(copy(s2,a+1,length(s2)-1),z2,code); z:=z2-z1+1; if z2>length(s) then z2:=length(s); s1:=copy(s,z1,z);
f := 1; p:=1; while (p<=length(s1)div 2)and(f<>0) do if (s1[p] <> s1[length(s1)-p+1]) then begin writeln('No'); f := 0; end else p:=p+1;
if f = 1 then writeln('Yes'); end else begin a:=8;z1:=0; while s2[a]<>' ' do inc(a); Val(copy(s2,8,a-8),z1,code); ch:=s2[a+1]; delete(s,z1,1); insert(ch,s,z1);
end; end; end. | | WA 50!!! what test???? | gooooooogol | 1075. Нитка в пространстве | 8 июн 2018 05:04 | 1 | | | WA9? NEED HELP! | Khamidjon | 1028. Звёзды | 6 июн 2018 22:14 | 3 | Check that arrays were initiated with zeroes. unfortunately it didn't help. | | accepted | Mikhail | 1026. Вопросы и ответы | 6 июн 2018 02:00 | 1 | //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; const int maxn = (int) 1e5; int a[maxn]; int main() { int n, x; cin >> n; fo(i, n) { cin >> a[i]; } sort(a, a + n); string str; cin >> str >> n; fo(i, n) { cin >> x; cout << a[x - 1] << '\n'; } re 0; } | | (JAVA) Runs fine in Eclipse but judge says there's a runtime error. HELP! | Kenny Castro-Monroy | 1001. Обратный корень | 6 июн 2018 00:28 | 3 | package timusreverseroot; import java.text.DecimalFormat; import java.util.*; public class TimusReverseRoot { public static void main(String[] args) { DecimalFormat f = new DecimalFormat("#0.0000"); Scanner keyboard = new Scanner(System.in); String inputs = keyboard.nextLine(); String[] parsed = inputs.split(" ");
for (String parsed1 : parsed) { int square = (int) Math.pow(Integer.parseInt(parsed1), 2); System.out.println(f.format(square)); } }
} I added in the package line but if I left that in, it would give me a compilation error, why is that? And this code runs perfectly fine in Netbeans but the judge gives a compilation error Edited by author 07.05.2018 22:48 Edited by author 07.05.2018 22:49 Edited by author 07.06.2018 01:49 | | accepted | Mikhail | 1931. Отличная команда | 4 июн 2018 23:20 | 1 | //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; int main() { int n, x; ii ans = mp(-1, 0); pair <ii, int> cur; cin >> n >> cur.fi.fi; cur.fi.se = cur.se = 0; fo(i, n - 1) { cin >> x; if (x >= cur.fi.fi) ++cur.fi.se; else { cur.fi.se++; ans = max(ans, mp(cur.fi.se, cur.se)); cur = mp(mp(x, 1), i + 1); } } ans = max(ans, mp(cur.fi.se, cur.se)); cout << ans.se + 1 << endl; } | | accepted | Mikhail | 1572. Екатеринозаводский колодец | 4 июн 2018 22:59 | 1 | //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; double calc () { int a, b; cin >> a >> b; if (a == 1) re b * 2; if (a == 2) re b; re sqrt(3) * b / 2.0; } int main() { int ans = 0, a, b; double fuck; cin >> a >> b; if (a == 1) fuck = b * 2; if (a == 2) fuck = b * sqrt(2); if (a == 3) fuck = b; int n; cin >> n; fo(i, n) { if (calc() <= fuck) ++ans; } cout << ans << endl; } | | accpeted | Mikhail | 1178. Дороги Акбардина | 4 июн 2018 22:31 | 1 | //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; int main() { int n; cin >> n; vector <pair<ii, int>> v(n); fo(i, n) { cin >> v[i].fi.fi >> v[i].fi.se; v[i].se = i + 1; } sort(all(v)); for (int i = 0; i < n; i += 2) { cout << v[i].se << ' '<< v[i + 1].se << '\n'; } } | | TEST 3 Please | Jumabek Alikhanov | 1788. О пользе зонтов | 4 июн 2018 14:06 | 3 | I have got error so many times. Wonder wht I am missing.. Here is my Python 3.4 Code n,m=map(int,input().split()) g=list(map(int,input().split())) b=list(map(int,input().split())) g.sort() b.sort() minUpset=0 for i in range(0,n): minUpset+=g[i] for s in range(0,min(n,m)): girlsUpset=0 boysUpset=0 for i in range(0,n-s): girlsUpset+=g[i] for j in range(0,m-s): boysUpset+=b[j] minUpset=min(girlsUpset+boysUpset*s,minUpset) print(minUpset)
Found the mistake. Always need to test when use loop. for s in range(0, min(n, m) + 1) | | accepted | Mikhail | 1788. О пользе зонтов | 4 июн 2018 14:05 | 1 | //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; const int maxn = 100; int a[maxn], b[maxn]; int main() { int n, m; cin >> n >> m; fo(i, n) cin >> a[i]; fo(i, m) cin >> b[i]; sort(a, a + n), sort(b, b + m); reverse(a, a + n), reverse(b, b + m); int ans = (int) 1e9, cur; fo(k, min(n, m) + 1) { cur = 0; for (int j = k; j < n; ++j) cur += a[j]; for (int j = k; j < m; ++j) cur += b[j] * k; ans = min (ans, cur); } cout << ans << endl; } | | accepted | Mikhail | 1576. Телефонные тарифы | 4 июн 2018 13:55 | 1 | //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; int calc () { string str; cin >> str; re (str[0] - '0') * 600 + (str[1] - '0') * 60 + stoi(str.substr(3, 2)); } int main() { int n1, n2, n3, c1, c2, t; cin >> n1 >> c1 >> n2 >> t >> c2 >> n3; int k, time; int ans = 0; cin >> k; while (k--) { time = calc(); if (time <= 6) continue; ans += (time + 59) / 60; } cout << "Basic: " << n1 + ans * c1 << endl; cout << "Combined: " << n2 + max(0, ans - t) * c2 << endl; cout << "Unlimited: " << n3 << endl; } | | Some tests and hint | Gleb Koveshnikov | 1698. Квадратная страна 5 | 2 июн 2018 20:55 | 1 | n=100: 168 n=555: 984 n=1000: 1785 n=1100: 1963 n=2000: 3598 I solved the equation x(x-1) % 10^i = 0 for every i>1 and i<=n by linear algorithm, using roots for i-1. | | If you get WA2 | RR | 1119. Метро | 2 июн 2018 19:31 | 9 | Test 2 is something like this 3 2 0 Good luck! Thank you very very much , I love u Thank you !!! you test help found my mistake i tested the answer is 500. it's right. but i still get WA 2 | | To Get AC test 10 on c++ | i_akash | 1133. Последовательность Фибоначчи | 1 июн 2018 16:56 | 1 | Use if(c> 8000000000LL || c< -8000000000LL) break ; this line in BInary search... code : [deleted] Edited by author 01.06.2018 17:02 Edited by moderator 20.11.2019 22:45 | | wht is the 4th test?? | rakeshvarna | 1576. Телефонные тарифы | 1 июн 2018 03:07 | 2 | plz can someone give the 4th test Try the case when total time is less than prepayed time in 'Combined' rate. |
|
|