{"id":20483387,"url":"https://github.com/styczynski/jnp1-task-1","last_synced_at":"2026-05-17T19:40:15.843Z","repository":{"id":72792650,"uuid":"107970090","full_name":"styczynski/jnp1-task-1","owner":"styczynski","description":"Task we have to do as a part of subject on University of Warsaw","archived":false,"fork":false,"pushed_at":"2017-10-23T11:01:11.000Z","size":109,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T16:16:20.878Z","etag":null,"topics":["c","jnp","parsing","regex","task","warsaw-university"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/styczynski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-23T11:00:50.000Z","updated_at":"2017-11-04T18:32:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a40e5e4-6d70-4694-a2b9-5decc2eda55d","html_url":"https://github.com/styczynski/jnp1-task-1","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/styczynski/jnp1-task-1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fjnp1-task-1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fjnp1-task-1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fjnp1-task-1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fjnp1-task-1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styczynski","download_url":"https://codeload.github.com/styczynski/jnp1-task-1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fjnp1-task-1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281178948,"owners_count":26456678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","jnp","parsing","regex","task","warsaw-university"],"created_at":"2024-11-15T16:17:14.219Z","updated_at":"2025-10-26T21:44:40.353Z","avatar_url":"https://github.com/styczynski.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JNP Task 1 (University of Warsaw)\n\nContributors: \n\n* @styczynski\n* @joald\n\n## Building\n\nPlease run `make` to build everything.\nRun `make rebuild` to force rebuild.\nRun `make clean` to clean compilation files.\nRun `make test` to perform tests.\n\n## Task Description\n\n### Task \"Points\"\n\nThis year we introduced negative points for multiple\ncooperation with the same person during this course .\nTo better understand the principle of disposing negative points bonus\nand help us calculate them, please write the appropriate program.\n\n### Functional requirements\n\nThe program is called with one argument, which is the name of the file\ncontaining IDs of the students participating in the assignments.\nEach Identifier is placed in a separate line.\nThe correct student ID consists of two lower case letters of the English alphabet and six digits\nor two small letters of English alphabet, letter m, a hyphen and four digits.\n\nAfter loading a list of student IDs from the file, the program reads from\nstandard input descriptions of teams that solved individual tasks.\nEach description resides in a separate line. A proper description of the team consists of\nword \"Grupa\" (pol. group), group number (number from 1 to 8), semicolon, word \"zadanie\" (pol. task),\ntask number (number from 1 to 6), semicolon and student identifiers\nseparated by a plus sign.\n\nAfter processing all the descriptions of the teams the program prints to the standard\noutput the list of students to substrac points and then exit with code 0.\nEach line written to the output is composed of student\nindex number (six of the last characters of its identifier), semicolon, the number of points\nto be substracted and the terminating semicolon. The data is sorted by index numbers.\n\n### Error handling\n\nThe program must be resistant to data incompatible with the specification.\nThe error messages described below should be written to the standard error output.\n\nIf a program has been called with an invalid number of parameters, it should\nexit with code 0 printing the following statement\n\n` Usage: PROGRAM file `\n\nwhere `PROGRAM` is the program name given in the command line\n(zero argument passed to the main function).\n\nIf a program cannot open a file given as an argument or\nany other error occurs when handling the file, it should\noutput a message:\n\n` Error: problem with file FILE `\n\nwhere `FILE` is the name of the file (the first argument passed to main)\nand they will end up with code 1.\n\nFor each line read from a file that does not contain a valid\nstudent identifier, the program should print the following message\n\n` Error in FILE, line N: TEXT `\n\nwhere `FILE` is the file name, `N` is the line number, and `TEXT` is the original\nline that was loaded.\n\nFor each input line read from a line of the file that contains the valid\nstudent ID, but such ID has already occurred, program should output a message:\n\n` Error in FILE, line N: ID `\n\nwhere `FILE` is the file name, `N` is the line number, and the `ID` is\nduplicate student ID.\n\nThe program prints erroneous lines in the file in the order of increasing line mnumbers.\n\nFor each line read from the standard input, which does not contain the correct\nteam description, the program should print the following message:\n\n` Error in cin, line N: TEXT `\n\nwhere `N` is the line number and `TEXT` is the original form of the loaded line.\n\nIf the team description is correct, there may be two reasons for questioning\nthe student ID: \n\n* it did not appear in the file passed as program argument, \n\n* it repeats in the same team. \n\nIn case of questioning the student ID, the program should output a message:\n\n` Error in cin, line 4: ID `\n\nwhere `N` is the line number and `ID` is the contested student ID.\n\nThe program outputs erroneous lines from the standard input\nin the order of ascending line numbers, and messages about questioned identifiers\nin the order they appear in the team's description.\nFor the invalid ids points are not counted!\n\nLines are numbered from 1.\nEmpty lines should be ignored, but they will matter when it comes to numbering.\nAny white characters in non-empty lines should be treated as\ninvalid and program should print them in output messages.\n\n### Usage example\n\nList of student IDs in _test_1.file:\n\n```\nab111111\ncd222222\nef333333\ngh444444\nij555555\nab111111\nab01234\ncab12345\nzzm-1000\n\n```\n\nList of team descriptions:\n\n```\n\ngrupa1/zadanie1/ab111111+cd222222\ngrupa2/zadanie1/gh444444+ij555555\ngrupa1/zadanie2/ab111111+cd222222+ef333333\ngrupa2/zadanie2/gh444444 + ij555555\ngrupa1/zadanie3/ab111111+cd222222+pr999999\ngrupa1/zadanie4/cd222222+cd222222\ngrupa1/zadanie5/cd222222+cd222222+cd222222\ngrupa1/zadanie5/cd222222+cd222222+ab111111\ngrupa1/zadanie5/cd222222+cd222222+pr999999\ngrupa1/zadanie5/pr999999+pr999999+pr999999\ngrupa1/zadanie2/ab111111+ef333333\n\n\n```\n\nThe program outputs to the standard output:\n\n```\n\n111111; 7;\n222222; 6;\n333333; 1;\n\n```\n\nThe program writes to the standard error output:\n\n```\n\nError in _test_1.file, line 6: ab111111\nError in _test_1.file, line 7: ab01234\nError in _test_1.file, line 8: cab12345\nError in cin, line 4: grupa2/zadanie2/gh444444 + ij555555\nError in cin, line 5: pr999999\nError in cin, line 6: cd222222\nError in cin, line 7: cd222222\nError in cin, line 7: cd222222\nError in cin, line 8: cd222222\nError in cin, line 9: cd222222\nError in cin, line 9: pr999999\nError in cin, line 10: pr999999\nError in cin, line 10: pr999999\nError in cin, line 10: pr999999\n\n\n```\n\n### Formal requirements\n\nThe program will be compiled on the student machine with a command\n\n`g++ -Wall -Wextra -O2 -std=c++17 punkty.cc -o punkty`\n\nExpected solution should not contain definitions of own structures and classes!\nInstead, you should use containers and algorithms\nprovided by the standard C++ language library extensively.\nInput and output operations should be implemented using C++ streams.\n\nThe solution should reside in the file `points.cc`, which shall be placed\nin the SVN repository in the directory\n\n`grupaN/zadanie1/ab123456+cd123456`\n\nor\n\n`grupaN/zadanie1/ab123456+cd123456+ef123456`\n\nwhere `N` is the group number, and `ab123456, cd123456, ef123456` are identifiers\nof the members of the team submitting this solution.\nCatalog with solution should contain no additional files to the source code,\nbut may contain a subdirectory `\"private\"` where you can place other files, such as your tests.\nFiles placed in subdirectories are not evaluated.\nDo not place in the repository large, binary, temporary or any other way unnecessary files.\n\n**English translation done by @styczynski (MIT license)**\n\n## Opis zadania\n\n### Zadanie punkty\n\nW tym roku wprowadziliłmy na tym przedmiocie punkty ujemne za wielokrotną\nwspółpracę z tą samą osobą. Aby lepiej zrozumieć zasady odejmowania tych punktów\ni pomóc nam je policzyć, prosimy o napisanie stosownego programu.\n\n### Wymagania funkcjonalne\n\nProgram wywoływany jest z jednym argumentem, który jest nazwą pliku\nzawierającego identyfikatory studentów uczestniczących w zająciach.\nKażdy identyfikator znajduje się w osobnej linii.\nPoprawny identyfikator studenta składa sią z dwóch małych liter alfabetu angielskiego\ni szejściu cyfr albo z dwóch małych liter alfabetu angielskiego, litery m, łącznika\ni czterech cyfr.\n\nPo wczytaniu z pliku listy identyfikatorów studentów program\nczyta ze standardowego wejścia opisy zespołów,\nktóre rozwiązywały poszczególne zadania.\nKażdy opis znajduje sią w osobnej linii.\nPoprawny opis zespołu składa sią ze słowa grupa, numeru grupy,\nbądącego liczbą od 1 do 8, ukośnika, słowa \"zadanie\",\nnumeru zadania (bądącego liczbą od 1 do 6), ukośnika i identyfikatorów studentów\noddzielonych znakiem plus.\n\nPo przetworzeniu wszystkich opisów zespołów program wypisuje na standardowe\nwyjscie liste studentów, którym należy odjąć punkty, a nastąpnie kończy się\nkodem wykonania 0. Każda wypisywana linia składa sią z numeru indeksu studenta\n(sześć ostatnich znaków jego identyfikatora), średnika, liczby punktów do odjącia\ni średnika.\nWypisywane dane są posortowane według numerów indeksów.\n\n### Obsługa błędów\n\nProgram musi być odporny na niezgodności danych wejściowych ze specyfikacją.\nOpisane poniżej komunikaty o błędach powinny być wypisywane na standardowe\nwyjście błędów.\n\nJeśli program został wywołany ze złą liczbą parametrów, powinien wypisać\nkomunikat:\n\n` Usage: PROGRAM file `\n\ngdzie `PROGRAM` jest nazwą programu, jaką podano w linii poleceń\n(zerowy argument przekazany do funkcji main), a nastąpnie zakończyć się kodem 1.\n\nJeśli program nie może otworzyć pliku o nazwie podanej jako argument lub\nwystąpił jakiś inny błąd związany z obsługą pliku, powinien wypisać komunikat:\n\n` Error: problem with file PLIK `\n\ngdzie `PLIK` jest nazwą pliku\n(pierwszy argument przekazany do funkcji main), a nastąpnie zakończyć się kodem 1.\n\nDla każdej czytanej z pliku linii, która nie zawiera poprawnego identyfikatora\nstudenta, program powinien wypisać komunikat:\n\n` Error in PLIK, line N: TEKST `\n\ngdzie `PLIK` jest nazwą pliku, `N` jest numerem wiersza, a `TEKST` to oryginalna\npostać wczytanej linii.\n\nDla każdej czytanej z pliku linii, która zawiera poprawny składniowo\nidentyfikator studenta, ale taki identyfikator już wcześniej wystąpił, program\npowinien wypisać komunikat:\n\n` Error in PLIK, line N: IDENTYFIKATOR `\n\ngdzie `PLIK` jest nazwą pliku, `N` jest numerem wiersza, a `IDENTYFIKATOR` to\npowtórzony identyfikator studenta.\n\nProgram wypisuje komunikaty o błędnych liniach w pliku w kolejności numerów\nlinii.\n\nDla każdej czytanej ze standardowego wejścia linii, która nie zawiera poprawnego\nopisu zespołu, program powinien wypisaą komunikat:\n\n` Error in cin, line N: TEKST `\n\ngdzie N jest numerem wiersza, a TEKST to oryginalna postać wczytanej linii.\n\nJeśli opis zespołu jest poprawny, to mogą wystąpią dwa powody zakwestionowania\nw nim identyfikatora studenta: \n\n* nie pojawił sią w pliku, którego nazwą podano jako argument programu,  \n\n* wystąpuje jego powtórzenie w tym samym zespole. \n\nW przypadku zakwestionowania identyfikatora studenta program powinien wypisać\nkomunikat:\n\n` Error in cin, line 4: IDENTYFIKATOR `\n\ngdzie `N` jest numerem wiersza, a `IDENTYFIKATOR` to zakwestionowany identyfikator\nstudenta.\n\nProgram wypisuje komunikaty o błędnych liniach ze standardowego wejścia\nw kolejności numerów linii, a komunikaty o zakwestionowanych identyfikatorach\nw kolejności ich występowania w opisie zespołu. Dla zakwestionowanych\nidentyfikatorów punkty nie są liczone.\n\nLinie numeruje się od jedynki. Puste linie należy ignorować, ale uwzglądniać je\nw numeracji. Wszelkie białe znaki w niepustych liniach należy traktować jako\nbłąd i uwzglądniać je w wypisywanych komunikatach.\n\n### Przykład użycia\n\nLista identyfikatorów studentów w pliku _test_1.file:\n\n```\n\nab111111\ncd222222\nef333333\ngh444444\nij555555\nab111111\nab01234\ncab12345\nzzm-1000\n\n```\n\nLista opisów zespołów:\n\n```\n\ngrupa1/zadanie1/ab111111+cd222222\ngrupa2/zadanie1/gh444444+ij555555\ngrupa1/zadanie2/ab111111+cd222222+ef333333\ngrupa2/zadanie2/gh444444 + ij555555\ngrupa1/zadanie3/ab111111+cd222222+pr999999\ngrupa1/zadanie4/cd222222+cd222222\ngrupa1/zadanie5/cd222222+cd222222+cd222222\ngrupa1/zadanie5/cd222222+cd222222+ab111111\ngrupa1/zadanie5/cd222222+cd222222+pr999999\ngrupa1/zadanie5/pr999999+pr999999+pr999999\ngrupa1/zadanie2/ab111111+ef333333\n\n```\n\nProgram wypisuje na standardowe wyjście:\n\n```\n\n111111;7;\n222222;6;\n333333;1;\n\n```\n\nProgram wypisuje na standardowe wyjście błędów:\n\n```\n\nError in _test_1.file, line 6: ab111111\nError in _test_1.file, line 7: ab01234\nError in _test_1.file, line 8: cab12345\nError in cin, line 4: grupa2/zadanie2/gh444444 + ij555555\nError in cin, line 5: pr999999\nError in cin, line 6: cd222222\nError in cin, line 7: cd222222\nError in cin, line 7: cd222222\nError in cin, line 8: cd222222\nError in cin, line 9: cd222222\nError in cin, line 9: pr999999\nError in cin, line 10: pr999999\nError in cin, line 10: pr999999\nError in cin, line 10: pr999999\n\n```\n\n### Wymagania formalne\n\nProgram będzie kompilowany na maszynie students poleceniem\n\n`g++ -Wall -Wextra -O2 -std=c++17 punkty.cc -o punkty`\n\nOczekiwane rozwiązanie nie powinno zawierać definicji własnych struktur i klas.\nZamiast tego należy intensywnie korzystać z kontenerów i algorytmów\ndostarczanych przez standardową bibliotekę jązyka C++. Obsługę wejścia i wyjścia\noraz pliku należy zrealizować za pomocą strumieni.\n\nRozwiązanie należy umieścić w pliku punkty.cc, który należy umieścić\nw repozytorium SVN w katalogu\n\n`grupaN/zadanie1/ab123456+cd123456`\n\nlub\n\n`grupaN/zadanie1/ab123456+cd123456+ef123456`\n\ngdzie `N` jest numerem grupy, a `ab123456, cd123456, ef123456` są identyfikatorami\nczłonków zespołu umieszczającego to rozwiązanie. Katalog z rozwiązaniem nie\npowinien zawierać innych plików, ale może zawierać podkatalog `\"private\"`, gdzie\nmożna umieszczaą różne pliki, np. swoje testy. Pliki umieszczone w tym\npodkatalogu nie bądą oceniane. Nie wolno umieszczać w repozytorium plików\ndużych, binarnych, tymczasowych ani innych zbędnych.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fjnp1-task-1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyczynski%2Fjnp1-task-1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fjnp1-task-1/lists"}