제출 #1079224

#제출 시각아이디문제언어결과실행 시간메모리
1079224ALeonidouAliens (IOI16_aliens)C++17
4 / 100
1 ms432 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; #define ll int #define F first #define S second #define sz(x) (ll)x.size() #define pb push_back typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; void printVct(vi &v){ for (ll i= 0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } long long ans; vector <vi> vis; void init(ll m){ vis.assign(m, vi(m)); ans = 0; } void mark_vis(ll x, ll y){ // dbg2(x,y); if (!vis[x][y]){ vis[x][y] = 1; ans++; } } long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { init(m); for (ll i =0; i<n; i++){ ll x = r[i], y = c[i]; // dbg3(i,x,y); ll val = x + y; bool direction = (x > y); //true if down-left ll squareDimensions = abs(x-y) + 1; // dbg2(direction, squareDimensions); for (ll j = 0; j<squareDimensions; j++){ for (ll k = 0; k<squareDimensions; k++){ if (direction) mark_vis(x-k, y+j); else mark_vis(x+k, y-j); } } } return ans; } /* 5 7 5 0 3 4 4 4 6 4 5 4 6 */

컴파일 시 표준 에러 (stderr) 메시지

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:48:12: warning: unused variable 'val' [-Wunused-variable]
   48 |         ll val = x + y;
      |            ^~~
#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...