Adhami's blog

By Adhami, history, 5 years ago, In English

Happy holiday!

Indian team decided to name themselves in the following way: SleepyShashwat,AsleepAdhyyan,RestingRajarshi,AwakeAnay.

So we, the Jordanian team decided to join them: Adhami,Wesam,OmarNaseer

Join us and change yours too!

Full text and comments »

  • Vote: I like it
  • +65
  • Vote: I do not like it

By Adhami, history, 5 years ago, In English

Hello, Codeforces!

As it was already announced, Eid Al-Adha is on 11 August, and it happens to be the last day of IOI 2019 which is held in Azerbaijan. So we invite all Muslims contestants (and leaders) to do the Eid Al-Adha prayer in the IOI 2019 accommodation for contestants, Athletes Village. There will be some desserts, but it would be awesome if you bring some from your country to share it with others. Remember to bring a prayer rug with you. Other contestants are also welcomed. Please comment down with if you are willing attend it. More details will be updated in this blog later. Also we are looking for an Imam, if you are willing to be one just PM me.

Good luck in IOI 2019!

Full text and comments »

  • Vote: I like it
  • +240
  • Vote: I do not like it

By Adhami, history, 5 years ago, In English

I am experiencing a weird problem that makes my performance in OI contests very bad. I can't identify easy problems, and I usually over-estimate them and ignore them and try in other harder problems, and even when I don't ignore them I don't have the mind to solve a problem rather than collecting points from subtasks.

I have seen this pattern in so many OI contest I participated in, I usually solve some harder problem while the easier one holds my score back, especially if those easy ones requires some greedy approach or some observation. Is there a way to avoid this situation rather than solving hundreds of these problems? I'm totally OK with solving some, but I have to practice on hard problems too. Does anybody experience this situation before? How did you get over it?

Full text and comments »

  • Vote: I like it
  • +72
  • Vote: I do not like it

By Adhami, history, 6 years ago, In English

I was reading IOI 2018 syllabus, but I was overwhelmed by the system of it. Some common known algorithms were placed under Excluded, but open to discussion or Excluded. So I decided to list them for ease of use.


  1. Modular division and inverse elements. Excluded

  2. Matrix multiplication and exponentiation. Excluded

  3. Theory of combinatorial games, e.g., NIM game. Excluded

  4. Randomized algorithms. Excluded

  5. String algorithms and data structures: there is evidence that the inter-reducibility between KMP, Rabin-Karp hashing, suffix arrays/tree, suffix automaton, and Aho-Corasick makes them difficult to separate. Excluded, but open to discussion

  6. Heavy-light decomposition and separator structures for static trees. Excluded, but open to discussion

  7. Two-dimensional tree-like data structures (such as a 2D statically balanced binary tree or a treap of treaps) used for 2D queries. Excluded

  8. Maximum flow. Flow/cut duality theorem. Excluded, but open to discussion


I have some questions though:

  1. Does Excluded, but open to discussion mean that it can't appear in IOI? What about other OI such as APIO?

  2. Does 7. mean that 2D Binary Indexed Tree is also excluded?

  3. Could someone list the other side? The topics that are hard but it is allowed in IOI syllabus.

Full text and comments »

  • Vote: I like it
  • +67
  • Vote: I do not like it

By Adhami, history, 6 years ago, In English

If you ask a Jordanian competitive programmer for a training advice, there is 98% chance that he would recommend you to solve Educational Rounds, ask Hiasat. However, getting your progress in Educational round tracked is hard, so here it comes!

I wrote this script way before, but my friends recently encouraged me to post it. It gets every Educational Round and what you have already solved in it.


import urllib.request, json import datetime s = [] w = [] with urllib.request.urlopen("https://codeforces.me/api/contest.list") as url: data = json.loads(url.read().decode()) for x in data["result"]: if x["name"].startswith("Educational"): w.append(x["name"]) s.append(x["id"]) e = [""]*len(w) #Edit this line to your handle: USER_NAME = "CPX" with urllib.request.urlopen("https://codeforces.me/api/user.status?handle="+USER_NAME) as url: data = json.loads(url.read().decode()) for x in data["result"]: if "verdict" in x and "contestId" in x: if x['verdict'] == 'OK': for i in range(0,len(s)): if x["contestId"] == s[i]: e[i] += x["problem"]["index"] break def contest(solved): if solved == "": return solved ans = [" "]*(ord(solved[-1])-ord("A")+1) for x in solved: ans[ord(x)-ord("A")] = x return "".join(ans) for i in range(0,len(w)): print("#" + str(i+1) + " https://codeforces.me/contest/" + str(s[len(w)-i-1]) + "\t: " + contest("".join(sorted(set(e[len(w)-i-1])))))

Change USER_NAME to match yours, and it will print it in this format:


#1 https://codeforces.me/contest/598 : AB DE #2 https://codeforces.me/contest/600 : BC E #3 https://codeforces.me/contest/609 : ABCDE #4 https://codeforces.me/contest/612 : ABCDE #5 https://codeforces.me/contest/616 : ABCDE ... #57 https://codeforces.me/contest/1096 : ABC #58 https://codeforces.me/contest/1101 : ABCDE #59 https://codeforces.me/contest/1107 : ABCD #60 https://codeforces.me/contest/1117 : ABCDE #61 https://codeforces.me/contest/1132 : ABC

You can copy it or print the output to a file. Check my script for Country-Wise standing.

And as always:

Solve Educational!

Full text and comments »

  • Vote: I like it
  • +87
  • Vote: I do not like it

By Adhami, history, 6 years ago, In English

Since the community asked for it, here it comes!

Download python script here

Edit the code to choose the contest id and the country and it will print the list of participants from the chosen country and their position is the standing. Feel free to edit the code to match your needs.

Full text and comments »

  • Vote: I like it
  • +59
  • Vote: I do not like it

By Adhami, history, 6 years ago, In English

Since it was requested, I spent around one hour to write this script.

Download the script here

It's ugly, I know. but it's way better in the night.

Full text and comments »

  • Vote: I like it
  • +55
  • Vote: I do not like it

By Adhami, history, 6 years ago, In English

TL;DR Basically Codeforces judging system is giving away Judgement failed for people right now.


Codeforces is giving 'Judgement failed' for an unknown reason right now. With some errors like:

Can't perform file operation while checking in K:\invoker-prod\work\codeforces6\56565a12f5d660ef444cf041111a64ff\check-d7f17df0dbf3307880be91ac544ea2df\check[CheckRequest {id='6eb47ab388b34d58f4a7048e8252dfcb', description='44396211 by SuperJava for 702D@66881 on test 14 (tests) uuid=888caf00f7897e0bc5cb2f558da201b2fe93e5c9, submissionFileHashCode=022405af07efc6c5c176ae132fb1eea6fb14d6d9, timestamp=13:56:53.', file='program.cpp', type='cpp.g++17', testType='UUID'}].

And Can't write compiled validator val.exe. . And Can't perform IO operation.

And many in queue pages. Why is that happening? Is this because the newest server change?

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

By Adhami, history, 7 years ago, In English

Hello, Codeforces!

Sometimes codeforces sets wrong languages when you test it. Sometimes even changing it does not work.

I was experimenting with C++11 and C++11 kept the default language for a long time!

It has been discussed in this blog Default Submission Language. Yes, I know it is 3 months ago, but it still happening sometimes.

After Installing this script, go to the submission page and you will see 'Save Option'. Note that it uses cookies to save your option.

Installation:

Tampermonkey or Violentmonkey or any other open source userscript manager is required. The source is available in Greasy Fork: Preferred Submission Language

Tampermonkey extension: Tampermonkey

Violentmonkey extension: Chrome | Mozilla Firefox | Opera

Full text and comments »

  • Vote: I like it
  • +14
  • Vote: I do not like it

By Adhami, history, 7 years ago, In English

Hello, Codeforces!

After I had created a script named 'input copier' Mike added copy button to codeforces. :')

But he missed that he did not add copy button to output so here I am with another script!

This script copies 'Copy' button to output.

Installation:

Tampermonkey or Violentmonkey or any other open source userscript manager is required. The source is available in Greasy Fork: Output Copier

Tampermonkey extension: Tampermonkey

Violentmonkey extension: Chrome | Mozilla Firefox | Opera

UPD: Mike did it again. He added copy button for output. Looks like that this script did not live either :'(

Thank you all!

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it

By Adhami, history, 7 years ago, In English

Are you tired from your big default code? You can fold it easily with this plugin.

Use Ctrl+Shift+; to fold all code between //fold and //endfold and Use Ctrl+Shift+' to unfold them

How to install it:

  1. Open Command Palette and type "Package Control: Add Repository"

  2. Write "https://github.com/khalilALADHAMi/Fold-This-Code" and press enter

  3. Install it from Package Control

Github: Fold-This-Code

Screenshots:

Before:

After:

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it

By Adhami, history, 7 years ago, In English

Hello, Codeforces!

"Input Copier" by RamiZk is about 6 months ago and he didn't update it . So I decided to write new one with the ability to edit it to suit you!

Any suggestions is very appreciated. If you found a bug please tell me so I can fix it as soon as I can.

How to use it:

Just click on input or output:

It will turn into red when you click it and it will return white after a second.

Installation:

Tampermonkey or Violentmonkey or any other open source userscript manager is required. The source is available in Greasy Fork: Input Copier

Tampermonkey extension: Tampermonkey

Violentmonkey extension: Chrome | Mozilla Firefox | Opera

UPD 1.1.0 : Fixed a bug when you can't copy multiple lines (remember to update it to fix the bug).

UPD 1.2.0 : You can copy output too

UPD 1.2.1 : Fixed firefox bug And Added support for the russian site

UPD: Thanks MikeMirzayanov for destroying the script by adding copy button.

UPD: The script is dead now after copy button update on codeforces. but Mike missed one thing that you can not copy the output. Do you want me to create another script that copies the output with the same style? Please let me know in the comments below

Full text and comments »

  • Vote: I like it
  • +51
  • Vote: I do not like it

By Adhami, history, 7 years ago, In English

I used 600B - Queries about less or equal elements to test those and used the same code but with change in input and output streams.

  Cin And Cout   Scanf And Printf
 GNU C++ 5.1.0  358ms Submission:35214275  155ms Submission:35214230
 GNU C++11 5.1.0  343ms Submission:35214311  156ms Submission:35214295
 GNU C++14 6.4.0  187ms Submission:35214315  186ms Submission:35214352
 GNU C++17 7.2.0  187ms Submission:35214359  187ms Submission:35214322

Looks like that scanf&printf is almost the same but cin&cout is slower under c++14.

Don't use cin&cout under c++14 to avoid TLE. Otherwise it is as good as scanf&printf and maybe better!

Scanf And Printf Code

#include <bits/stdc++.h>
using namespace std;
int n,m,val;
vector<int> a;
int main() {
	scanf("%d%d",&n,&m);
	for(int i = 0;i < n;i++){
		scanf("%d",&val);
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		scanf("%d",&b);
		printf("%d ",upper_bound(a.begin(),a.end(),b)-a.begin());
	}
	return 0;
}

Cin And Cout Code

#include <bits/stdc++.h>
using namespace std;
int n,m,val;
vector<int> a;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	for(int i = 0;i < n;i++){
		cin >> val;
		a.push_back(val);
	}
	sort(a.begin(),a.end());
	for(int i = 0;i < m;i++){
		int b;
		cin >> b;
		cout << upper_bound(a.begin(),a.end(),b)-a.begin() << " ";
	}
	return 0;
}

Full text and comments »

  • Vote: I like it
  • -16
  • Vote: I do not like it

By Adhami, history, 7 years ago, In English

I was solving 408B and it was easy. I submitted the code and I get WA in test 15. Then I have revised the code and changed the arrays' size from 1000 to 1005 and it worked! In the problem maximum length of both strings is 1000. why did that happen? first submission WA on test 15 : 28983405. second submission Accepted : 28983523

please do not down vote before telling me what is the wrong in my question

UPD: Thanks to fresher96 for his explanation

UPD:scanf format string article in Wikipedia mentions that:

%s : Scan a character string. The scan terminates at whitespace. A null character is stored at the end of the string, which means that the buffer supplied must be at least one character longer than the specified input length.

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it