Netcore Round2 help done
DM @MRTRUELIVING_IX✔️ ▶️ for Test Clearance
#Netcore #Round2 #Coding
Sliding window Algorithm
DM @MRTRUELIVING_IX
#Netcore #Round2 #Coding
Sliding window Algorithm
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
DEVRev Ai help done ✅✔️
Coding & SQL are done✔️
Test accomplished ✅
DM for @MRTRUELIVING_IX 💯 TEST CLEARANCE
ALL PLACEMENT HELP AVAILABLE
@MRTRUELIVING_IX
@MRTRUELIVING_IX
#DEVREV #AI #DONE
APPLY NOW
https://t.me/code_alphix/4138
Coding & SQL are done
Test accomplished ✅
DM for @MRTRUELIVING_IX 💯 TEST CLEARANCE
ALL PLACEMENT HELP AVAILABLE
@MRTRUELIVING_IX
@MRTRUELIVING_IX
#DEVREV #AI #DONE
APPLY NOW
https://t.me/code_alphix/4138
Please open Telegram to view this post
VIEW IN TELEGRAM
DevRev help ✅
Test accomplished ❤️ with 💯 clearance
DM for OA help
@MRTRUELIVING_IX
@MRTRUELIVING_IX
All Placement help available
#DevRev #AI #CODING
Test accomplished ❤️ with 💯 clearance
DM for OA help
@MRTRUELIVING_IX
@MRTRUELIVING_IX
All Placement help available
#DevRev #AI #CODING
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
struct Line {
int x1, y1, x2, y2;
};
int countCells(Line line, pair<int, int> star, bool split) {
if (line.x1 == line.x2) {
return split ? min(abs(star.second - line.y1), abs(star.second - line.y2)) + 1 : abs(line.y1 - line.y2) + 1;
} else {
return split ? min(abs(star.first - line.x1), abs(star.first - line.x2)) + 1 : abs(line.x1 - line.x2) + 1;
}
}
bool intersects(Line a, Line b, pair<int, int>& intersection) {
if (a.x1 == a.x2 && b.y1 == b.y2) {
if (b.x1 <= a.x1 && a.x1 <= b.x2 && a.y1 <= b.y1 && b.y1 <= a.y2) {
intersection = {a.x1, b.y1};
return true;
}
} else if (a.y1 == a.y2 && b.x1 == b.x2) {
if (a.x1 <= b.x1 && b.x1 <= a.x2 && b.y1 <= a.y1 && a.y1 <= b.y2) {
intersection = {b.x1, a.y1};
return true;
}
}
return false;
}
int main() {
int N, K;
cin >> N;
vector<Line> lines(N);
for (int i = 0; i < N; ++i) {
cin >> lines[i].x1 >> lines[i].y1 >> lines[i].x2 >> lines[i].y2;
if (lines[i].x1 > lines[i].x2 || (lines[i].x1 == lines[i].x2 && lines[i].y1 > lines[i].y2)) {
swap(lines[i].x1, lines[i].x2);
swap(lines[i].y1, lines[i].y2);
}
}
cin >> K;
map<pair<int, int>, vector<Line>> stars;
for (int i = 0; i < N; ++i) {
for (int j = i + 1; j < N; ++j) {
pair<int, int> intersection;
if (intersects(lines[i], lines[j], intersection)) {
stars[intersection].push_back(lines[i]);
stars[intersection].push_back(lines[j]);
}
}
}
int totalIntensity = 0;
for (auto& star : stars) {
if (star.second.size() / 2 == K) {
vector<int> intensities;
for (auto& line : star.second) {
intensities.push_back(countCells(line, star.first, true));
}
totalIntensity += *min_element(intensities.begin(), intensities.end());
}
}
cout << totalIntensity << endl;
return 0;
}
`
Magic' star
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1
Please open Telegram to view this post
VIEW IN TELEGRAM
int main() {
int n;
scanf("%d", &n);
int arr[n];
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
}
int count = 0;
int num = arr[0];
for (int i = 1; i < n; i++) {
if (num != arr[i]) {
count++;
num = arr[i];
}
}
printf("%d\n", count);
return 0;
}Array Code
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1
int main() {
int n, m, k, d = 1, rv = 0;
cin >> n >> m;
vector<set<int>> f(n);
for (int i = 0, u, v; i < m; ++i) {
cin >> u >> v;
f[u].insert(v);
f[v].insert(u);
}
cin >> k;
vector<bool> w(n, true);
rv = n;
while (rv < k) {
vector<bool> nw(n, false);
for (int i = 0; i < n; ++i) {
int cnt = 0;
for (int fr : f[i]) cnt += w[fr];
if (w[i] && cnt == 3) nw[i] = true;
else if (!w[i] && cnt < 3) nw[i] = true;
}
w = nw;
rv += count(w.begin(), w.end(), true);
++d;
}
cout << d;
return 0;
}Office Rostering
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1