Task: | Niitty |
Sender: | nikke5 |
Submission time: | 2024-11-07 21:07:24 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
#4 | WRONG ANSWER | 0 |
#5 | WRONG ANSWER | 0 |
#6 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.19 s | 1, 2, 3, 4, 5, 6 | details |
#2 | TIME LIMIT EXCEEDED | -- | 1, 2, 3, 4, 5, 6 | details |
#3 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5, 6 | details |
#4 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5, 6 | details |
#5 | ACCEPTED | 0.00 s | 1, 2, 3, 4, 5, 6 | details |
#6 | TIME LIMIT EXCEEDED | -- | 2, 3, 4, 5, 6 | details |
#7 | TIME LIMIT EXCEEDED | -- | 2, 3, 4, 5, 6 | details |
#8 | WRONG ANSWER | 0.00 s | 2, 3, 4, 5, 6 | details |
#9 | ACCEPTED | 0.01 s | 2, 3, 4, 5, 6 | details |
#10 | TIME LIMIT EXCEEDED | -- | 3, 4, 5, 6 | details |
#11 | TIME LIMIT EXCEEDED | -- | 3, 4, 5, 6 | details |
#12 | WRONG ANSWER | 0.01 s | 3, 4, 5, 6 | details |
#13 | TIME LIMIT EXCEEDED | -- | 3, 4, 5, 6 | details |
#14 | TIME LIMIT EXCEEDED | -- | 4, 5, 6 | details |
#15 | TIME LIMIT EXCEEDED | -- | 4, 5, 6 | details |
#16 | WRONG ANSWER | 0.01 s | 4, 5, 6 | details |
#17 | TIME LIMIT EXCEEDED | -- | 4, 5, 6 | details |
#18 | TIME LIMIT EXCEEDED | -- | 5, 6 | details |
#19 | TIME LIMIT EXCEEDED | -- | 5, 6 | details |
#20 | WRONG ANSWER | 0.02 s | 5, 6 | details |
#21 | TIME LIMIT EXCEEDED | -- | 5, 6 | details |
#22 | TIME LIMIT EXCEEDED | -- | 6 | details |
#23 | TIME LIMIT EXCEEDED | -- | 6 | details |
#24 | WRONG ANSWER | 0.14 s | 6 | details |
#25 | TIME LIMIT EXCEEDED | -- | 6 | details |
Compiler report
input/code.cpp: In function 'void createRects(int)': input/code.cpp:57:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<flower> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 57 | if (level == flist.size()){ | ~~~~~~^~~~~~~~~~~~~~~ input/code.cpp:74:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<flower>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 74 | for (int i = 0; i<flist[level].size(); i++){ // LOOP THE CURRENT LEVEL (FLOWER TYPE) | ~^~~~~~~~~~~~~~~~~~~~ input/code.cpp: In function 'int main()': input/code.cpp:201:9: warning: unused variable 'v' [-Wunused-variable] 201 | int v = 0; | ^ input/code.cpp:202:9: warning: unused variable 'overlap' [-Wunused-variable] 202 | int overlap = 0; | ^~~~~~~ input/code.cpp: In function 'int getMaxRectAmount(std::vector<int>, int)...
Code
#include <iostream> #include <cmath> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <chrono> #include <iomanip> #include <algorithm> typedef long long ll; using namespace std; struct flower{ int x, y; int id; int listIt; char idC; //Remove later, its just to visualize }; vector<vector<flower>> flist; //cout << flist[0][i].x << ", " << flist[0][i].y << ", " << flist[0][i].idC << ", " << distLists[0][0][i].first << ", " << distLists[0][1][i].first << "\n"; int idList[200] = {0}; vector<vector<int>> rectList; vector<int> currentX, currentY; void findSmallestRect(vector<int> X, vector<int> Y, vector<int> &p) { // find Xmax and Xmin int Xmax = *max_element(X.begin(), X.end()); int Xmin = *min_element(X.begin(), X.end()); // find Ymax and Ymin int Ymax = *max_element(Y.begin(), Y.end()); int Ymin = *min_element(Y.begin(), Y.end()); // print all four coordinates p[0] = Xmin; p[1] = Xmax; p[2] = Ymin; p[3] = Ymax; } void createRects(int level){ if (level == flist.size()){ vector<int> EndCoords(4); // Pienimmän mahdollisen suorakulmion koordinaatit järjestyksessä; XMax, Xmin, Ymax, Ymin. findSmallestRect(currentX, currentY, EndCoords); rectList.push_back(vector<int>()); for (int i = 0; i < 4; i++) { rectList[rectList.size()-1].push_back(EndCoords[i]); } // cout << rectList[rectList.size() - 1][0] << ", " << rectList[rectList.size() - 1][1] << ", " << rectList[rectList.size() - 1][2] << ", " << rectList[rectList.size() - 1][3] << "\n"; // cout << "\n"; return; } for (int i = 0; i<flist[level].size(); i++){ // LOOP THE CURRENT LEVEL (FLOWER TYPE) currentX.push_back(flist[level][i].x); currentY.push_back(flist[level][i].y); // cout << flist[level][i].idC << ", "; createRects(level + 1); currentX.pop_back(); currentY.pop_back(); } } int getMaxRectAmount(vector<int> Coords, int n){ int dirX1; int dirY1; dirX1 = Coords[1] - Coords[0]; dirY1 = Coords[3] - Coords[2]; int x1 = Coords[0]; int y1 = Coords[2]; int x2 = Coords[1]; int y2 = Coords[3]; if (dirX1 >= 0 && dirY1 >= 0) { return (n - y2) * (y1 + 1) * (n - x2) * (x1 + 1); } } int getOverlapRectAmount(vector<int> rect1, vector<int> rect2, int n){ vector<int> XCoords; vector<int> YCoords; XCoords.push_back(rect1[0]); XCoords.push_back(rect1[1]); YCoords.push_back(rect1[2]); YCoords.push_back(rect1[3]); XCoords.push_back(rect2[0]); XCoords.push_back(rect2[1]); YCoords.push_back(rect2[2]); YCoords.push_back(rect2[3]); vector<int> EndCoords(4); findSmallestRect(XCoords, YCoords, EndCoords); // Tehdään suorakulmien yhdistelmästä pienin suorakulmio ja lisätään se overlappiin int currentOverlap = getMaxRectAmount(EndCoords, n); return currentOverlap; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); fill_n(idList, 200, -1); int n; cin >> n; cin.ignore(1,'\n'); int id = 0; vector<string> sI; for (int y = n-1; y>=0; y--){ sI.push_back(string()); getline(cin, sI[sI.size()-1]); } int c = n-1; for (int y = n - 1; y >= 0; y--) { string s = sI[c]; c--; for (int x = 0; x < n; x++) { flower f; f.x = x; f.y = y; f.idC = s[x]; if (idList[(int)s[x]] == -1) { idList[(int)s[x]] = id; flist.push_back(vector<flower>()); id++; } f.id = idList[(int)s[x]]; f.listIt = flist[f.id].size(); flist[f.id].push_back(f); } } sort(flist.begin(), flist.end(), [](const vector<flower> & a, const vector<flower> & b){ return a.size() < b.size(); }); // JÄRJESTÄ LISTA HARVINAISIMMASTA YLEISIMPÄÄN createRects(0); sort(rectList.begin(), rectList.end()); auto it = unique(rectList.begin(), rectList.end()); rectList.erase(it, rectList.end()); int v = 0; int overlap = 0; // for (int i = 0; i<rectList.size(); i++){ // LISÄÄ KAIKKIEN SUORAKULMIEN VASTAUKSET VASTAUKSEEN // for (int j = 0; j < 4; j++) // { // cout << rectList[i][j] << ", "; // } // int rectAmount = getMaxRectAmount(rectList[i], n); // cout << "rectAmount: " << rectAmount << "\n"; // v += rectAmount; // } // vector<vector<int>> overlapRects; // int rectAmount = getMaxRectAmount(rectList[0], n); // v += rectAmount; // for (int k = 0; k < 4; k++) // { // cout << rectList[0][k] << ", "; // } // cout << " RECT AMOUNT: " << rectAmount << "\n"; // for(int i = 1; i<rectList.size(); i++){ // LOOPATAAN KAIKKI, JA KATSOTAAN OVERLAPIT EDELLISEEN // for (int k = 0; k < 4; k++) // { // cout << rectList[i-1][k] << ", "; // } // cout << " -> "; // for (int k = 0; k < 4; k++) // { // cout << rectList[i][k] << ", "; // } // int rectAmount = getMaxRectAmount(rectList[i], n); // v += rectAmount; // cout << " RECT AMOUNT: " << rectAmount; // vector<int> XCoords; // vector<int> YCoords; // XCoords.push_back(rectList[i-1][0]); // XCoords.push_back(rectList[i-1][1]); // YCoords.push_back(rectList[i-1][2]); // YCoords.push_back(rectList[i-1][3]); // XCoords.push_back(rectList[i][0]); // XCoords.push_back(rectList[i][1]); // YCoords.push_back(rectList[i][2]); // YCoords.push_back(rectList[i][3]); // int EndCoords[4]; // findSmallestRect(XCoords, YCoords, EndCoords); // Tehdään suorakulmien yhdistelmästä pienin suorakulmio ja lisätään se overlappiin // overlapRects.push_back(vector<int>()); // overlapRects[overlapRects.size() - 1].insert(overlapRects[overlapRects.size() - 1].begin(), EndCoords, EndCoords + 4); // // for (int k = 0; k < 4; k++) // // { // // cout << overlapRects[overlapRects.size() - 1][k] << ", "; // // } // int currentOverlap = getMaxRectAmount(overlapRects[overlapRects.size()-1], n); // overlap += currentOverlap; // cout << " Overlap:" << currentOverlap << "\n"; // // int currentOverlap = getMaxRectAmount(overlapRects[overlapRects.size()-1], n); // // v -= currentOverlap; // // cout << "- Overlap:" << currentOverlap << "\n"; // // for (int j = i+1; j < rectList.size(); j++) // LASKETAAN KAIKKIEN RECTIEN OVERLAPIT VERRATTUNA KAIKKIIN MUIHIN // // { // // for (int k = 0; k < 4; k++) // // { // // cout << rectList[i][k] << ", "; // // } // // cout << " -> "; // // for (int k = 0; k < 4; k++) // // { // // cout << rectList[j][k] << ", "; // // } // // int rectAmount = getMaxRectAmount(rectList[j], n); // // cout << " RECT AMOUNT: " << rectAmount; // // vector<int> XCoords; // // vector<int> YCoords; // // XCoords.push_back(rectList[j][0]); // // XCoords.push_back(rectList[j][1]); // // YCoords.push_back(rectList[j][2]); // // YCoords.push_back(rectList[j][3]); // // XCoords.push_back(rectList[i][0]); // // XCoords.push_back(rectList[i][1]); // // YCoords.push_back(rectList[i][2]); // // YCoords.push_back(rectList[i][3]); // // int EndCoords[4]; // // findSmallestRect(XCoords, YCoords, EndCoords); // Tehdään suorakulmien yhdistelmästä pienin suorakulmio ja lisätään se overlappiin // // overlapRects.push_back(vector<int>()); // // overlapRects[overlapRects.size()-1].insert(overlapRects[overlapRects.size()-1].begin(), EndCoords, EndCoords + 4); // // // for (int k = 0; k < 4; k++) // // // { // // // cout << overlapRects[overlapRects.size() - 1][k] << ", "; // // // } // // // int currentOverlap = getMaxRectAmount(overlapRects[overlapRects.size()-1], n); // // // overlap += currentOverlap; // // // cout << " Overlap:" << currentOverlap << "\n"; // // // int currentOverlap = getMaxRectAmount(overlapRects[overlapRects.size()-1], n); // // // v -= currentOverlap; // // // cout << "- Overlap:" << currentOverlap << "\n"; // // } // // cout << "\n"; // } // sort(overlapRects.begin(), overlapRects.end()); // auto it2 = unique(overlapRects.begin(), overlapRects.end()); // overlapRects.erase(it2, overlapRects.end()); // cout << "--- \n\n"; // vector<vector<int>> wentOverOverlaps; // for (int i = 0; i<overlapRects.size(); i++){ // // for (int k = 0; k < 4; k++) // // { // // cout << overlapRects[i][k] << ", "; // // } // int currentOverlap = getMaxRectAmount(overlapRects[i], n); // for (int j = 0; j<wentOverOverlaps.size(); j++){ // vector<int> XCoords; // vector<int> YCoords; // XCoords.push_back(overlapRects[i][0]); // XCoords.push_back(overlapRects[i][1]); // YCoords.push_back(overlapRects[i][2]); // YCoords.push_back(overlapRects[i][3]); // XCoords.push_back(wentOverOverlaps[j][0]); // XCoords.push_back(wentOverOverlaps[j][1]); // YCoords.push_back(wentOverOverlaps[j][2]); // YCoords.push_back(wentOverOverlaps[j][3]); // int EndCoords[4]; // findSmallestRect(XCoords, YCoords, EndCoords); // currentOverlap -= getMaxRectAmount(vector<int>({EndCoords[0],EndCoords[1],EndCoords[2],EndCoords[3]}), n); // } // overlap += currentOverlap; // cout << "Overlap:" << currentOverlap << "\n"; // wentOverOverlaps.push_back(overlapRects[i]); // } // for (int i = 0; i<rectList.size(); i++){ // LISÄÄ KAIKKIEN SUORAKULMIEN VASTAUKSET VASTAUKSEEN // for (int j = 0; j < 4; j++) // { // cout << rectList[i][j] << ", "; // } // int rectAmount = getMaxRectAmount(rectList[i], n); // cout << "rectAmount: " << rectAmount << "\n"; // v += rectAmount; // } // for (int i = 0; i < rectList.size(); i++) // { // int rectAmount = getMaxRectAmount(rectList[i], n); // int overlapRects = 0; // for (int j = 0; j < i; j++) // { // overlapRects += getOverlapRectAmount(rectList[i], rectList[i - j], n); // int overlappingOverlaps =; // } // v += rectAmount - overlapRects; // } // cout << "V: " << v << " Overlap: " << overlap << " VASTAUS:" << rectList.size() << "\n"; cout << rectList.size(); }
Test details
Test 1
Group: 1, 2, 3, 4, 5, 6
Verdict: WRONG ANSWER
input |
---|
10 TNCTNPNTPC NPPNTNTPTP NTNTTCNTCT NPCPNPPNTT ... |
correct output |
---|
2035 |
user output |
---|
1995 |
Test 2
Group: 1, 2, 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 NFWQLWNWYS DZOQJVXFPJ CNHXPXMCQD QRTBVNLTQC ... |
correct output |
---|
9 |
user output |
---|
(empty) |
Test 3
Group: 1, 2, 3, 4, 5, 6
Verdict: WRONG ANSWER
input |
---|
10 XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX ... |
correct output |
---|
3025 |
user output |
---|
100 |
Test 4
Group: 1, 2, 3, 4, 5, 6
Verdict: WRONG ANSWER
input |
---|
10 FFFFFFFFFF FFFFFCFFFF FFFFFFJFFF FFFFFFFFFF ... |
correct output |
---|
12 |
user output |
---|
9 |
Test 5
Group: 1, 2, 3, 4, 5, 6
Verdict: ACCEPTED
input |
---|
1 X |
correct output |
---|
1 |
user output |
---|
1 |
Test 6
Group: 2, 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
20 BBCBUBOUOBBCUUBBCOUO BOUCOOCUBCOOOCOBOCUO UCCUUUOBCOCBCBUBUCOO BUOBUCUCUOOBCOOUBUOO ... |
correct output |
---|
38724 |
user output |
---|
(empty) |
Test 7
Group: 2, 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
20 CBGLSHGZHYZDWBNDBJUG SMUXOJQYPXZDTMJUIWOJ XIDSTNBGHKRKOVUVMINB MTQGCFRUHQKALXRNCQGS ... |
correct output |
---|
8334 |
user output |
---|
(empty) |
Test 8
Group: 2, 3, 4, 5, 6
Verdict: WRONG ANSWER
input |
---|
20 KKKKKKKKKKKKKKKKKKKK KKKKKKKKKKKKKKKKKKKK KKKKKKKKKKKKKKKKKKKK KKKKKKKKKKKKKKKKKKKK ... |
correct output |
---|
44100 |
user output |
---|
400 |
Test 9
Group: 2, 3, 4, 5, 6
Verdict: ACCEPTED
input |
---|
20 AAAAAAAAXAAAAAAAAAAA AAAWAAAAAAAAAAAAAOAA AAAAAAAAAAAAAAAAAPAA AAAAAAAAKAAAAAAAAAAZ ... |
correct output |
---|
18 |
user output |
---|
18 |
Test 10
Group: 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
50 GRGREEEGREGXRXXEGXXREXGRRRGRRR... |
correct output |
---|
1584665 |
user output |
---|
(empty) |
Test 11
Group: 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
50 AITIISJUHCCRZNKSDCNQKYSQRINFWJ... |
correct output |
---|
1077746 |
user output |
---|
(empty) |
Test 12
Group: 3, 4, 5, 6
Verdict: WRONG ANSWER
input |
---|
50 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO... |
correct output |
---|
1625625 |
user output |
---|
2500 |
Test 13
Group: 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
50 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF... |
correct output |
---|
1680 |
user output |
---|
(empty) |
Test 14
Group: 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 NNCMDCDDCCNNNDNCMMNCDCDCCDCDNM... |
correct output |
---|
25325366 |
user output |
---|
(empty) |
Test 15
Group: 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 LIMQQIHASECROEVILNVULGWZJPPKOG... |
correct output |
---|
22342463 |
user output |
---|
(empty) |
Test 16
Group: 4, 5, 6
Verdict: WRONG ANSWER
input |
---|
100 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... |
correct output |
---|
25502500 |
user output |
---|
10000 |
Test 17
Group: 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 QXQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... |
correct output |
---|
25650 |
user output |
---|
(empty) |
Test 18
Group: 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 NAANANMMKNKKAKMKMAKNKMNKMMNNAA... |
correct output |
---|
403292767 |
user output |
---|
(empty) |
Test 19
Group: 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 OMYWATTLURKQPTKEFMGGYAOONXWVSC... |
correct output |
---|
388111321 |
user output |
---|
(empty) |
Test 20
Group: 5, 6
Verdict: WRONG ANSWER
input |
---|
200 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... |
correct output |
---|
404010000 |
user output |
---|
40000 |
Test 21
Group: 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
200 LLLLLLLLLLLLLLLLLHLLLLLLLLLLLL... |
correct output |
---|
14159445 |
user output |
---|
(empty) |
Test 22
Group: 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 VVHWVUHVHUWWWVUUUWVUUHUUWHWUVW... |
correct output |
---|
15683003812 |
user output |
---|
(empty) |
Test 23
Group: 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 OIMZGEQSBMBDSDXSWRFNKSGFEBBTJE... |
correct output |
---|
15575906951 |
user output |
---|
(empty) |
Test 24
Group: 6
Verdict: WRONG ANSWER
input |
---|
500 IIIIIIIIIIIIIIIIIIIIIIIIIIIIII... |
correct output |
---|
15687562500 |
user output |
---|
250000 |
Test 25
Group: 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW... |
correct output |
---|
3058970930 |
user output |
---|
(empty) |