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
String observation code available ✔️
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int f(string& s, vector<string>& v, unordered_map<string, int>& m) {
if (m.count(s)) return m[s];
int res = 0;
for (auto& x : v) {
size_t p = s.find(x);
if (p != string::npos) {
string ns = s.substr(0, p) + s.substr(p + x.size());
res = max(res, 1 + f(ns, v, m));
}
}
return m[s] = res;
}
int main() {
int n;
cin >> n;
vector<string> subs(n);
for (int i = 0; i < n; ++i) {
cin >> subs[i];
}
string s;
cin >> s;
unordered_map<string, int> m;
cout << f(s, subs, m) << endl;
return 0;
}
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1
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
❤1
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2
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://boards.greenhouse.io/devrev/jobs/5248554004
Batch -2020/21/22/23/24/25 batch allowed
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://boards.greenhouse.io/devrev/jobs/5248554004
Batch -2020/21/22/23/24/25 batch allowed
Tcs Codevita ✔️
Test accomplished
#Tcs #Codevita #Coding
All placement help available
@MRTRUELIVING_IX▶️
Test accomplished
#Tcs #Codevita #Coding
All placement help available
@MRTRUELIVING_IX
Please open Telegram to view this post
VIEW IN TELEGRAM
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int dist(pair<int, int> p1, pair<int, int> p2) {
return (p1.first - p2.first) * (p1.first - p2.first) +
(p1.second - p2.second) * (p1.second - p2.second);
}
bool match(vector<pair<int, int>> &poly1, vector<pair<int, int>> &poly2) {
size_t n = poly1.size();
if (n != poly2.size()) return false;
vector<int> d1, d2;
for (size_t i = 0; i < n; ++i) {
d1.push_back(dist(poly1[i], poly1[(i + 1) % n]));
d2.push_back(dist(poly2[i], poly2[(i + 1) % n]));
}
for (size_t r = 0; r < n; ++r) {
bool isMatch = true;
for (size_t i = 0; i < n; ++i) {
if (d1[i] != d2[(i + r) % n]) {
isMatch = false;
break;
}
}
if (isMatch) return true;
}
return false;
}
int main() {
int np;
cin >> np;
vector<vector<pair<int, int>>> polys(np);
for (int i = 0; i < np; ++i) {
int ns;
cin >> ns;
polys[i].resize(ns);
for (int j = 0; j < ns; ++j) {
cin >> polys[i][j].first >> polys[i][j].second;
}
}
for (int i = 0; i < np; ++i) {
for (int j = i + 1; j < np; ++j) {
if (match(polys[i], polys[j])) {
cout << i + 1 << " " << j + 1;
return 0;
}
}
}
return 0;
}
Find pair
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1🫡1
import java.util.*;
public class SC {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
Map<String, String[]> g = new HashMap<>();
for (int i = 0; i < n; i++) {
String[] p = sc.nextLine().split("=");
String gn = p[0].trim();
String[] gd = p[1].trim().split("[(), ]+");
g.put(gn, gd);
}
int t = Integer.parseInt(sc.nextLine());
Map<String, int[]> v = new HashMap<>();
while (true) {
String ln = sc.nextLine();
if (ln.matches("[a-zA-Z]+")) {
String tg = ln.trim();
sim(g, v, tg, t);
break;
}
String[] p = ln.split(" ");
String iv = p[0];
int[] tm = Arrays.stream(p, 1, p.length)
.mapToInt(Integer::parseInt)
.toArray();
v.put(iv, tm);
}
sc.close();
}
private static void sim(Map<String, String[]> g, Map<String, int[]> v, String tg, int t) {
Map<String, int[]> o = new HashMap<>();
for (String gn : g.keySet()) {
o.put(gn, new int[t]);
}
for (int c = 1; c < t; c++) {
for (String gn : g.keySet()) {
String[] d = g.get(gn);
String op = d[0];
String i1 = d[1];
String i2 = d[2];
int v1 = val(i1, o, v, c - 1);
int v2 = val(i2, o, v, c - 1);
int r = comp(op, v1, v2);
o.get(gn)[c] = r;
}
}
int[] to = o.get(tg);
for (int i = 0; i < t; i++) {
System.out.print(to[i] + (i == t - 1 ? "\n" : " "));
}
}
private static int val(String var, Map<String, int[]> o, Map<String, int[]> v, int c) {
if (v.containsKey(var)) {
return v.get(var)[c];
} else {
return o.get(var)[c];
}
}
private static int comp(String op, int v1, int v2) {
int r = 0;
switch (op) {
case "AND":
r = v1 & v2;
break;
case "OR":
r = v1 | v2;
break;
case "NAND":
r = ~(v1 & v2) & 1;
break;
case "NOR":
r = ~(v1 | v2) & 1;
break;
case "XOR":
r = v1 ^ v2;
break;
default:
r = 0;
break;
}
return r;
}
}
Shannon Circuits
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1👀1