Submission #1271954

#TimeUsernameProblemLanguageResultExecution timeMemory
1271954alexiahAliens (IOI16_aliens)C++20
Compilation error
0 ms0 KiB
#include "aliens.h" #include <bits/stdc++.h>; using namespace std; long long take_photos(int cant, int m, int k, vector<int> r, vector<int> c) { vector<vector<int>> grid (r.size() , vector <int>(c.size())); int n = r.size() , m = c.size(); for(int i = 0; i < r.size(); i++){ for(int j = 0; j < c.size(); j++){ grid[r[i]][c[i]]++; } } for(int i = 0; i < r.size(); i++){ for(int j = 0; j < c.size(); j++){ grid[r[i]][c[i]]++; } } int ans = 0; for(int i = 0; i < n; i++){ int act = 0; for(int j = 0; j < m; j++){ if(grid[i][j] > 0) act = max(act , j); } if(ans != -1)ans += abs((i+1)-(act+1)) * abs((i+1)-(act+1)); } return ans; }

Compilation message (stderr)

aliens.cpp:2:25: warning: extra tokens at end of #include directive
    2 | #include <bits/stdc++.h>;
      |                         ^
aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:7:24: error: declaration of 'int m' shadows a parameter
    7 |     int n = r.size() , m = c.size();
      |                        ^
aliens.cpp:5:37: note: 'int m' previously declared here
    5 | long long take_photos(int cant, int m, int k, vector<int> r, vector<int> c) {
      |                                 ~~~~^
aliens.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
aliens_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~