Submission #787600

#TimeUsernameProblemLanguageResultExecution timeMemory
787600yeysoMars (APIO22_mars)C++17
0 / 100
1 ms200 KiB
#include "mars.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> m; vector<vector<int>> v; void dfs(int i, int j, int z){ if(!v[i][j] and m[i][j] != 48){ v[i][j] = z; if(i < m.size() - 1) dfs(i+1, j, z); if(j < m.size() - 1) dfs(i, j+1, z); if(i > 0) dfs(i-1, j, z); if(j > 0) dfs(i, j-1, z); } } void comp(int grid){ } vector<vector<int>> decode(string z, int x){ for(int i = 0; i < x; i ++){ } } string encode(vector<vector<int>> matrix){ } string process(vector<vector<string>> a, int i, int j, int k, int n){ /* Phase 1 - Each corner stores 1 bit of info Phase 2 - Each corner stores 4 bits of info Phase 3 - Each corner stores 9 bits of info Each corner stores phase ^ 2 bits of info Phase 2 - info from 2s are combined into info of 3 0 1 3 0 2 0 1 0 0 0 0 0 2 0 2 0 1 0 0 0 0 0 1 0 1 0 1 1 2 1 2 1 3 4 3 4 3 1 2 1 2 1 3 4 3 4 3 1 2 1 2 1 */ string z(100, '0'); k += 1; int x = 0; vector<vector<int>> grid(k+1, vector<int>(k+1, 0)); for(int r = 0; r < k * k; r ++){ grid[r / k][r % k + 1] = a[0][2][r]; grid[r / k + 1][r % k + 1] = a[2][2][r]; grid[r / k + 1][r % k] = a[2][0][r]; grid[0][0] = a[0][0][0]; } for(int r = 0; r < grid.size(); r ++){ for(int c = 0; c < grid[r].size(); c ++){ //cout << grid[r][c] << " "; z[x] = grid[r][c]; x += 1; } //cout << "\n"; } if(k == n){ vector<vector<int>> grid01(k + 1, vector<int>(k, 0)); vector<vector<int>> grid10(k, vector<int>(k + 1, 0)); vector<vector<int>> grid11(k, vector<int>(k, 0)); for(int r = 0; r < k * k; r ++){ grid01[r / (k)][r % k] = a[0][1][r]; grid01[r / (k) + 1][r % k] = a[2][1][r]; grid10[r / k][r % k] = a[1][0][r]; grid10[r / k][r % k + 1] = a[1][2][r]; grid11[r / k][r % k] = a[1][1][r]; } vector<vector<int>> matrix(2 * k + 1, vector<int>(2 * k + 1, 0)); v = matrix; for(int r = 0; r < grid.size(); r ++){ for(int c = 0; c < grid[r].size(); c ++){ matrix[r * 2][c * 2] = grid[r][c]; } } for(int r = 0; r < grid01.size(); r ++){ for(int c = 0; c < grid01[r].size(); c ++){ matrix[r * 2][c * 2 + 1] = grid01[r][c]; } } for(int r = 0; r < grid10.size(); r ++){ for(int c = 0; c < grid10[r].size(); c ++){ matrix[r * 2 + 1][c * 2] = grid10[r][c]; } } for(int r = 0; r < grid11.size(); r ++){ for(int c = 0; c < grid11[r].size(); c ++){ matrix[r * 2 + 1][c * 2 + 1] = grid11[r][c]; } } int zz = 1; m = matrix; cout << "\n"; for(int r = 0; r < matrix.size(); r ++){ for(int c = 0; c < matrix[r].size(); c ++){ dfs(r, c, zz); zz += 1; if(matrix[r][c] == 48) cout << 0 << " "; if(matrix[r][c] == 49) cout << 1 << " "; //cout << matrix[r][c] << " "; } cout << "\n"; } set<int> is; for(int i = 0; i < v.size(); i ++){ for(int j = 0; j < v[i].size(); j ++){ //cout << v[i][j] << " "; is.insert(v[i][j]); } //cout << "\n"; } if(is.size() - 1 == 0 and v[0][0] != 0){ z = bitset<100>(is.size()).to_string(); } else { z = bitset<100>(is.size() - 1).to_string(); } reverse(z.begin(), z.end()); return z; } //if(k == 2) cout << "\n"; return z; } /* g++ -Wall -lm -static -DEVAL -o mars -O2 mars.cpp grader.cpp -std=c++17 1 2 1 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1 1 1 8 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 0 1 0 1 */

Compilation message (stderr)

mars.cpp: In function 'void dfs(int, int, int)':
mars.cpp:11:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   if(i < m.size() - 1) dfs(i+1, j, z);
      |      ~~^~~~~~~~~~~~~~
mars.cpp:12:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   if(j < m.size() - 1) dfs(i, j+1, z);
      |      ~~^~~~~~~~~~~~~~
mars.cpp: In function 'std::vector<std::vector<int> > decode(std::string, int)':
mars.cpp:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
mars.cpp: In function 'std::string encode(std::vector<std::vector<int> >)':
mars.cpp:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:63:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   for(int r = 0; r < grid.size(); r ++){
      |                  ~~^~~~~~~~~~~~~
mars.cpp:64:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |    for(int c = 0; c < grid[r].size(); c ++){
      |                   ~~^~~~~~~~~~~~~~~~
mars.cpp:90:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   90 |   for(int r = 0; r < grid.size(); r ++){
      |                  ~~^~~~~~~~~~~~~
mars.cpp:91:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |    for(int c = 0; c < grid[r].size(); c ++){
      |                   ~~^~~~~~~~~~~~~~~~
mars.cpp:95:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |   for(int r = 0; r < grid01.size(); r ++){
      |                  ~~^~~~~~~~~~~~~~~
mars.cpp:96:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   96 |    for(int c = 0; c < grid01[r].size(); c ++){
      |                   ~~^~~~~~~~~~~~~~~~~~
mars.cpp:100:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  100 |   for(int r = 0; r < grid10.size(); r ++){
      |                  ~~^~~~~~~~~~~~~~~
mars.cpp:101:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  101 |    for(int c = 0; c < grid10[r].size(); c ++){
      |                   ~~^~~~~~~~~~~~~~~~~~
mars.cpp:105:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |   for(int r = 0; r < grid11.size(); r ++){
      |                  ~~^~~~~~~~~~~~~~~
mars.cpp:106:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  106 |    for(int c = 0; c < grid11[r].size(); c ++){
      |                   ~~^~~~~~~~~~~~~~~~~~
mars.cpp:113:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  113 |   for(int r = 0; r < matrix.size(); r ++){
      |                  ~~^~~~~~~~~~~~~~~
mars.cpp:114:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  114 |    for(int c = 0; c < matrix[r].size(); c ++){
      |                   ~~^~~~~~~~~~~~~~~~~~
mars.cpp:124:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  124 |   for(int i = 0; i < v.size(); i ++){
      |                  ~~^~~~~~~~~~
mars.cpp:125:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  125 |    for(int j = 0; j < v[i].size(); j ++){
      |                   ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...