Submission #226169

#TimeUsernameProblemLanguageResultExecution timeMemory
226169AaronNaiduSplit the Attractions (IOI19_split)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, m; vector<pair<int, int> > topLeft; vector<pair<int, int> > bottomRight; vector<vector<int> > board; bool works(int startx, int endx, int starty, int endy) { if (startx > endx or starty > endy) { return false; } for (int x = startx; x <= endx; x++) { for (int y = starty; y < endy; y++) { if (board[x][y] >= board[startx-1][y] or board[x][y] >= board[startx+1][y] or board[x][y] >= board[x][starty-1] or board[x][y] >= board[x][starty+1]) { return false; } } } //cout << startx << "," << starty << " to " << endx << "," << endy << "\n"; return true; } ll count_rectangles(vector<vector<int> > a) { n = a.size(); m = a[0].size(); board = a; for (int i = 1; i < n - 1; i++) { for (int j = 1; j < m - 1; j++) { if (a[i][j] < a[i-1][j] and a[i][j] < a[i][j-1]) { topLeft.push_back({i,j}); //cout << "Top left could be " << i << "," << j << "\n"; } if (a[i][j] < a[i+1][j] and a[i][j] < a[i][j+1]) { bottomRight.push_back({i,j}); //cout << "Bottom right could be " << i << "," << j << "\n"; } } } ll totalCount = 0; for (auto i : topLeft) { for (auto j : bottomRight) { totalCount += works(i.first,j.first, i.second, j.second); } } return totalCount; }

Compilation message (stderr)

/tmp/ccqJlU0X.o: In function `main':
grader.cpp:(.text.startup+0x27a): undefined reference to `find_split(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status