ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 2023. Donald is a postman

C++ solution
Posted by gleb@il 29 Nov 2019 00:31
#include <iostream>
#include <set>
using namespace std;
int main() {
int index = 0, cnt = 0, n;
set<string> a, b, c;
a.insert("Alice");
a.insert("Ariel");
a.insert("Aurora");
a.insert("Peter");
a.insert("Phil");
a.insert("Olaf");
a.insert("Phoebus");
a.insert("Ralph");
a.insert("Robin");
b.insert("Bambi");
b.insert("Belle");
b.insert("Bolt");
b.insert("Mulan");
b.insert("Mowgli");
b.insert("Mickey");
b.insert("Silver");
b.insert("Simba");
b.insert("Stitch");
c.insert("Dumbo");
c.insert("Genie");
c.insert("Jiminy");
c.insert("Kuzko");
c.insert("Kida");
c.insert("Kenai");
c.insert("Tarzan");
c.insert("Tiana");
c.insert("Winnie");
cin >> n;
int a1=0,b1=1,c1=2;
for(int i = 0; i < n; i++)
{
{
cnt += abs(index - a1);
index = a1;
}
{
cnt += abs(index - b1);
index = b1;
}