Submission #758058

#TimeUsernameProblemLanguageResultExecution timeMemory
758058roCatalystTowers (NOI22_towers)C++14
0 / 100
913 ms1048576 KiB
#include <bits/stdc++.h> using namespace std; vector<string> all; void generate(string s, int N){ if (N == 0) { all.push_back(s); } else { generate(s+'1',N-1); generate(s+'0',N-1); } } /* all_perms = [] def generate(s,N): if N == 0: all_perms.append(s) else: generate(s+'0',N-1) generate(s+'1',N-1) N = int(input()) generate("",N) print(all_perms) */ int main() { int N; cin >> N; /*generate("",N);*/ vector<pair<int,int>> cities; int maxX = -1; int maxY = -1; for (int i = 0; i < N; i++) { int xi; int yi; cin >> xi >> yi; maxX = max(xi,maxX); maxY = max(yi,maxY); cities.push_back(make_pair(xi,yi)); } int coords[maxX][maxY]; for (int i = 0; i < maxX; i++) { for (int j = 0; j < maxY; j++) { coords[i][j] = -1; } } for (int i = 0; i < N; i++) { pair<int,int> ci = cities[i]; coords[ci.first-1][ci.second-1] = i; } bool ans[N]; for (int i = 0; i < maxX; i++) { int start = -1; int end = -1; for (int j = 0; j < maxY; j++) { int curr = coords[i][j]; if (curr) { if (start != -1) { start = curr; } end = curr; } ans[curr] = true; } } for (int i = 0; i < N; i++) { cout << ans[i]; } cout << endl; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:66:13: warning: variable 'end' set but not used [-Wunused-but-set-variable]
   66 |         int end = -1;
      |             ^~~
#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...