accidentallygivenfuck's blog

By accidentallygivenfuck, history, 6 months ago, In English

bros… we got tourist edits before i hit 2100

https://www.instagram.com/reel/C6yGRZVLXQS/

what else hasn’t happened yet but tourist edits have?

Full text and comments »

By accidentallygivenfuck, history, 5 years ago, In English

Find yourself a guy who looks at you the way Marcin_smu looks at Petr,

marcin

and beware of guys who look at you the way Errichto looks at Petr.

Full text and comments »

By accidentallygivenfuck, history, 5 years ago, In English

My following solution for Leapfrog: Ch. 1 failed:

#include <iostream>
#include <string>
using namespace std;

int T;

int main() {
  cin >> T;
  
  for (int test = 1; test <= T; ++test)
  {
    string s;
    cin >> s;

    int n = s.length();
    int b = 0;
    for (int i = 0; i < n; i++)
      if (s[i] == 'B')
        b++;

    char yesno = ( b+1 <= n-1 && n-1 <= 2*b ?'Y' :'N');
    cout << "Case #" << test << ": " << yesno << "\n";
  }

  return 0;
}

I compared the outputs for the reference solution and mine. But they are the same. diff doesn't find any differences.

Here is the Dropbox folder with my and reference solution's sources, inputs and outputs. I don't believe I submitted the wrong files.

Can someone confirm or reject the validity of my solution?

Full text and comments »

By accidentallygivenfuck, history, 8 years ago, In English

Is there anyone who is studying at KAIST and can't find teammates for team contests?

I am a freshman and I don't know how I should look for teammates.

Any advice would be appreciated a lot.

Full text and comments »

By accidentallygivenfuck, history, 8 years ago, In English

Although the video is 2 months old, I believe most of you haven't watched it yet.

So here is the YouTube link: How Snapchat's filters work

Full text and comments »

By accidentallygivenfuck, history, 8 years ago, In English

Hello Codeforces,

I am currently located in Turkmenistan and (I believe) for some political reasons ISPs here have blocked most of the websites (Facebook, Youtube, etc have long been blocked here before. When I mean "most" I mean almost any website hosted outside of Turkmenistan and Russia. That's just an observation though). Codeforces is one of the few websites I can currently access. So I decided to ask for a help here.

Would anyone owning an online server (vps, cloud, etc. anything I can ssh into and use as proxy) be kind enough to give me their ssh credentials (or even better/more secure would be to add a new user to the server for me), so that I can bypass the firewall?

I have a cloud server running on Amazon AWS. But I can not use it as proxy or vpn, because it is blocked as well.

Please comment below if you are able to help.

Thanks.

P.S. Sorry for baity title.

Full text and comments »

By accidentallygivenfuck, history, 8 years ago, In English

Because, no one told you about "News" section in Russian version of Codeforces!

http://media.riffsy.com/videos/7d8ebb7cf892c4d15fbb1da536b2a445/webm

Full text and comments »

By accidentallygivenfuck, history, 9 years ago, In English

Stop fucking yourself. If it has been long enough for you to exhibit some kind of progress but you haven't fucking shown any yet, then fucking quit. You are little fucking cunt that can't just put their ass down and fucking do the shit they should do. You are fucking feeble looser that would be the most use to themselves only and only by closing themselves in a fucking toilet and fucking their hand (And yeah their hand, because that is the only thing they can fuck). If you still insist that you ain't no fucking cumming pussy, then fucking force yourself to get some shit done and show me that you are not some worthless shit. But you know what? I know what exactly will happen. You will accept the fucking challenge but still you will fucking fuck yourself in the anus and won't achieve any fucking shit. Now prove me wrong fucking motherfucker.

Full text and comments »

By accidentallygivenfuck, history, 9 years ago, In English

Or a tree of questions?

a question on trees

Full text and comments »

By accidentallygivenfuck, history, 9 years ago, In English

Mihail, put an ad on tourist's profile page and use the money earned from the ads to buy a birthday gift for Tanya each year.

I don't often think in such a cute way. So, Mihail, think twice.

Full text and comments »

By accidentallygivenfuck, history, 9 years ago, In English
By accidentallygivenfuck, history, 9 years ago, In English

I am trying to redeem my $100 AWS credits that I got from HackerRank CodeStorm, but I don't have credit card, so I can't complete my registration to AWS.

Does anyone know how to redeem AWS credits without credit card?

Full text and comments »

By accidentallygivenfuck, history, 9 years ago, In English

Hello,

I am having hard time in understanding the statement of problem Cow Run, USACO 2012 January Contest. I can't understand what the problem statement asks for.

At first, I thought problem was about finding a sequence of moves that, no matter how Bessie moves, guarantees that cows will end the run at a position no more than K units distance away from the initial position.

But, then, why are Bessie's moves provided?

I would appreciate any help.
Thanks.

Full text and comments »

By accidentallygivenfuck, history, 9 years ago, In English

Hello Codeforces,

I want to share with you a simple tool that I've been using for a while now that I named "Ineffable".

What is ineffable?

Simple command-line grader for local grading of solutions for problems of competitive programming contests. It is written in Python and it uses timeout Perl library to limit resources (time and memory limits) of program being tested.

It works on Ubuntu, and I guess it should work on any Linux/Unix system as long as Python and Perl are installed.

Screenshots


(Original quote is "Success consists of going from failure to failure without loss of enthusiasm")

Installation

Run the following commands on your terminal:

$ mkdir ~/.ineffable
$ cd ~/.ineffable
$ wget https://bitbucket.org/silap/ineffable/downloads/ineffable-1.0.zip
$ unzip master.zip
$ rm master.zip
$ mv silap-ineffable-*/* .
$ rm -r silap-ineffable-*/
$ sudo ln -s ~/.ineffable/ineffable /usr/local/bin/ineffable

Or alternatively you may run this command if you have curl installed:

$ bash < <(curl -sL https://bitbucket.org/silap/ineffable/raw/f208b207160eacd8ba4c30c078d1255e309c6b40/install.sh)

Configuration

Whenever you run ineffable it looks for ineff.json file. You can also tell ineffable which configuration file to use using this syntax: inefabble another.json.

Configuring ineffable is easy and quite intuitive. After you install ineffable you can view the example configuration file that is located at ~/.ineffable/ineff.json.example.

Available configuration options are as follows:

key example value Description
pkdesc "Balkan OI 2014 Day 2 Problem Ephesus" Package description. (Optional)
pbcode "steeple" Problem code. Ineffable searches for string {PROBLEM} in keys warmup, execute, inp, out and tstdir, and replaces them with pbcode value. (Optional)
tl 1000 Time limit (in milliseconds). (Required)
ml 65536 Memory limit (in kilobytes). (Required)
warmup "g++ -O2 -o solution solution.cpp" Command to be executed before the grading starts. For example, it can be used to compile C++ code. Grading stops if the command exits with non-zero code (such as, when compilation fails). (Optional)
execute "./solution" or "python solution.py" Command that runs the solution. Solution needs to read from stdin and write to stdout. (Required)
tstdir "steeple_tests" Directory where the test files are located. If ommited, it is assumed that tests are located in the current directory. (Optional)

There are 2 different ways to show ineffable which files are input files and which files are output files:

  1. Smart stars:

    "inp": "input*.txt",
    "out": "output*.txt"
  1. Listing files.

    # Syntax 1
    
    "iopairs": {
      "input1.txt": "output1.txt",
      "input2.txt": "output2.txt",
      "input3.txt": "output3.txt"
    }
    
    # Syntax 2
    
    "iopairs": {
      "inp": {"input1.txt", "input2.txt", "input3.txt"},
      "out": {"output1.txt", "output2.txt", "output3.txt"}
    }

See it at work (sample session)

Let's solve problem Cow Steeplechase of USACO 2011 November Contest.

$ # Create folder `steeple` in your desktop and another folder `steeple_tests` inside it.
$ mkdir Desktop/steeple
$ cd Desktop/steeple
$ mkdir steeple_tests
$ cd steeple_tests
$
$ # Download and extract test data into `steeple/steeple_tests/`.
$ wget -q http://usaco.org/current/data/steeple.zip
$ unzip -q steeple.zip
$ rm steeple.zip
$ cd ..
$
$ # Create file `ineff.json` and configure.
$ touch ineff.json
$ echo '{
  "pkdesc": "Cow Steeplechase (USACO Gold November 2011 Contest)",
  "pbcode": "steeple",
  "tl": 3000,
  "ml": 65536,
  "warmup": "g++ -std=c++11 -O2 -o {PROBLEM} {PROBLEM}.cpp",
  "execute": "./{PROBLEM}",
  "tstdir": "{PROBLEM}_tests/",
  "inp": "I.*",
  "out": "O.*"
}' >ineff.json
$
$ # Create `steeple.cpp` and open it with your favorite editor to code your solution.
$ touch steeple.cpp
$ vim steeple.cpp
$ # ...
$
$ # Test your solution
$ ineffable

As I haven't spent much effort in making ineffable, there may be some bugs. I won't be able to fix the bugs at least till the IOI 2015 ends.

Ineffable is a simple project and anyone who knows some Python can alter it for their own purpose or even add some features. Project is available on Bitbucket (sorry no Github, it is blocked in my country :/).

EDIT: "Installation" section updated.
EDIT 2: Download links updated (to be able to keep number of downloads :P).

Full text and comments »

By accidentallygivenfuck, history, 9 years ago, In English

Today, I was checking the official solution for problem grassplant of USACO 2011 December Contest. I ran the solution on 12th test and it gave me runtime error (segmentation fault). I realized it was caused by stack overflow. Then (somewhy) I added (int) before E[u].size() in the function hang() and ran it on 12th test again. Surprisingly, stack did not overflow this time.

I tried doing it several times, and the code without (int) always run out of 8Mb of stack memory and the code with it used less than 8Mb of stack memory.

Can anyone who gets this stuff tell why this happens?

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Hello Codeforces,

Today, after getting bored of sleeping, I decided to sharpen up my vim skills. So I opened the firefox, then developer tools, and set the 'keybindings' to 'vim style', and decided to write a user script. A user script that automatically downvotes the spammers.

If you are fed up of spammers as much as I am, then I invite you to use my user script. To install the user script in your browser, just follow these 2 instructions:

1. Install Greasemonkey/Tampermonkey

Choose your browser
Greasemonkey Tampermonkey

2. Install So spammer, much asshole!

Let Greasemonkey/Tampermonkey auto-install the user script

Who are those "spammers"?

Well, at the moment, there are only 6 people in the list of the spammers. But, these 6 people are (mostly) those that asked for downvotes in some particular comment/post. These people will be removed from this list after the real list of the spammers will be ready. That is why, I ask you to suggest spammers (with reasonable evidence alongside, of course). Thanks.

So here is the list of those 6 "spammers":

  1. c1one
  2. aradhya_makkar
  3. Fear_Is_An_Illusion
  4. kursatbakis0
  5. NinjaCoder
    • I like the personality of this guy, but his comments, they are, ...

    • To aradhya, I will not WASTE my time on a such miserable rat like you, but if you will continue punishing my Mother language you will not live long enough to regret it!!!
    • Mal bolsan name edeli biz? (Чё нам делать то, если ты баран?)

    • and lots of other comments that contain the f-word
  6. accidentallygivenfuck
    • so that the above 5 guys won't be angry at me

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

This years last USACO contest is running!

You can participate in the contest by starting your 4-hour time block any time between April 3 and April 6.
You need to register for the http://usaco.org to be able to participate in the contest.

Contest link: http://usaco.org/index.php?page=viewcontest
Duration: 4 hours

For most problems resource limitations are as follows:

Time Limit: 2s (C/C++/Pascal), 4s (Java/Python)
Memory Limit: 256MB

P.S. I know that the title sucks, so does the grader of the interactive problem :/

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Hey 'sup? Check dis out: http://com.google

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Once upon a time my password used to be 123456, but not anymore :'(

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Hello Codeforces,

A few days ago, I was sitting and thinking, and invented a data structure with time complexities and (preprocessing and per query, respectively) I was being lazy and surfing the net :P I was searching for some good HTML5 <canvas> tutorials/example usages and found this.

ololosh

It is cool, but not so beautiful. So I modified it a bit to make it more beautiful and more "competitive programmerish". :P :D :P

trollolosh

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Hi Codeforces,

Does anyone know a way to download problems in a PDF file for later offline use?

I know a somewhat not-so-good way:

  • Open codeforces.com/contest/<contestid>/problems
  • Press ctrl+p
  • Set the correct preferences, so that the result will be readable
  • Print to file

But I remember that I downloaded 482B - Interesting Array in a PDF file at the beginning of the contest, when I tried to open the problem page. I don't know how, but maybe it was because the servers were too busy. That is why, I thought there might be a way to download problems in PDF format.

I still have the file. This file is more convenient than printing the problems page.

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Hello Codeforces!

Today, I translated the BIT tutorial by e-maxx into English:
http://silap.tk/blog/2014/12/fenwick-tree/

PS Please, inform if there are any grammar mistakes or typos.

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

After 3 years, finally decided to share this.

3 year old screenshot

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Original Post

IOI 2014 APP for Android is out!! You can download it at

https://play.google.com/store/apps/details?id=org.ioi.olympiad2014

Key features are:

  • LIVE scores
  • Results
  • Schedule of events
  • News

Minimum Requirements:

  • Android Froyo (2.2.3)
  • Wifi or 3G/4G
  • GPS

  

BTW Organizers also will be providing the Leaders and Deputy Leaders Acer Iconia A1-811 tablet (Android 4.2 OS) for use during IOI2014.

Acer Iconia A1-811 picture

Full text and comments »

By accidentallygivenfuck, 10 years ago, In English

Problem link: 128C - Games with Rectangle
Official Editorial: Russian only

I've got idea that is different from the official one, plus:

  • with worse time complexity
  • with worse memory requirements
  • and it seems to be incorrect one

But the problem is, I can't find what I am missing :(
Here is my code (unfortunately, it is full of trash, and I am too lazy to remove them). So I am asking you to help.

Brief description

Initially there is a grid and a rectangle already drawn on it of size n × m.You need to draw k more rectangles and each rectangle should be drawn inside the previously drawn rectangle. Rectangles' sides should be one the grid lines and they should not touch each other. The problem is in how many ways you can do it (or, how many different pictures can you draw in total).

My solution

Let's assume that there is a grid of size w × h. Let g(w, h, k) be number of different pictures you can obtain by drawing k rectangles one inside another (plus, they should be drawn on the grid lines and their borders should not touch each other). It is clear that answer for the whole problem will be g(n - 1, m - 1, k). Now we need to know how to calculate g:

g[w][h][k] = 2*g[w][h-1][k] - g[w][h-2][k] + 2*g[w-1][h][k] - g[w-2][h][k] - 4*g[w-1][h-1][k] + g[w-2][h-2][k-1];

But using the above formula, we get negative value for some w, h, k, which is obviously incorrect. :(
It seems like that I forgot to add something or am removing too much.

Full text and comments »