Task: | Niitty |
Sender: | nikke5 |
Submission time: | 2024-11-07 21:32:42 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
#4 | TIME LIMIT EXCEEDED | 0 |
#5 | TIME LIMIT EXCEEDED | 0 |
#6 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 1, 2, 3, 4, 5, 6 | details |
#2 | TIME LIMIT EXCEEDED | -- | 1, 2, 3, 4, 5, 6 | details |
#3 | ACCEPTED | 0.01 s | 1, 2, 3, 4, 5, 6 | details |
#4 | ACCEPTED | 0.01 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 | ACCEPTED | 0.09 s | 2, 3, 4, 5, 6 | details |
#9 | TIME LIMIT EXCEEDED | -- | 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 | TIME LIMIT EXCEEDED | -- | 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 | TIME LIMIT EXCEEDED | -- | 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 | TIME LIMIT EXCEEDED | -- | 5, 6 | details |
#21 | TIME LIMIT EXCEEDED | -- | 5, 6 | details |
#22 | TIME LIMIT EXCEEDED | -- | 6 | details |
#23 | TIME LIMIT EXCEEDED | -- | 6 | details |
#24 | TIME LIMIT EXCEEDED | -- | 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:69:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<flower>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 69 | for (int i = 0; i < flist[level-1].size(); i++) | ~~^~~~~~~~~~~~~~~~~~~~~~~ input/code.cpp:93:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<flower>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 93 | 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:1...
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]); } for (int i = 0; i < flist[level-1].size(); i++) { // LOOP THE CURRENT LEVEL (FLOWER TYPE) currentX.push_back(flist[level-1][i].x); currentY.push_back(flist[level-1][i].y); // cout << flist[level][i].idC << ", "; findSmallestRect(currentX, currentY, EndCoords); rectList.push_back(vector<int>()); for (int i = 0; i < 4; i++) { rectList[rectList.size() - 1].push_back(EndCoords[i]); } currentX.pop_back(); currentY.pop_back(); } // 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 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); } } vector<vector<char>> visualization; for (int y = 0; y<n; y++){ visualization.push_back(vector<char>()); for(int x = 0; x<n; x++){ visualization[y].push_back(sI[y][x]); } } 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] << ", "; // } // cout << "\n"; // for (int y = rectList[i][2]; y <= rectList[i][3]; y++) // { // for (int x = rectList[i][0]; x <= rectList[i][1]; x++) // { // cout << visualization[y][x] << " "; // } // cout << "\n"; // } // } cout << rectList.size(); }
Test details
Test 1
Group: 1, 2, 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 TNCTNPNTPC NPPNTNTPTP NTNTTCNTCT NPCPNPPNTT ... |
correct output |
---|
2035 |
user output |
---|
(empty) |
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: ACCEPTED
input |
---|
10 XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX ... |
correct output |
---|
3025 |
user output |
---|
3025 |
Test 4
Group: 1, 2, 3, 4, 5, 6
Verdict: ACCEPTED
input |
---|
10 FFFFFFFFFF FFFFFCFFFF FFFFFFJFFF FFFFFFFFFF ... |
correct output |
---|
12 |
user output |
---|
12 |
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: ACCEPTED
input |
---|
20 KKKKKKKKKKKKKKKKKKKK KKKKKKKKKKKKKKKKKKKK KKKKKKKKKKKKKKKKKKKK KKKKKKKKKKKKKKKKKKKK ... |
correct output |
---|
44100 |
user output |
---|
44100 |
Test 9
Group: 2, 3, 4, 5, 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
20 AAAAAAAAXAAAAAAAAAAA AAAWAAAAAAAAAAAAAOAA AAAAAAAAAAAAAAAAAPAA AAAAAAAAKAAAAAAAAAAZ ... |
correct output |
---|
18 |
user output |
---|
(empty) |
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: TIME LIMIT EXCEEDED
input |
---|
50 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO... |
correct output |
---|
1625625 |
user output |
---|
(empty) |
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: TIME LIMIT EXCEEDED
input |
---|
100 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... |
correct output |
---|
25502500 |
user output |
---|
(empty) |
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: TIME LIMIT EXCEEDED
input |
---|
200 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC... |
correct output |
---|
404010000 |
user output |
---|
(empty) |
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: TIME LIMIT EXCEEDED
input |
---|
500 IIIIIIIIIIIIIIIIIIIIIIIIIIIIII... |
correct output |
---|
15687562500 |
user output |
---|
(empty) |
Test 25
Group: 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
500 WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW... |
correct output |
---|
3058970930 |
user output |
---|
(empty) |