Category : segmentation-fault

#include <iostream> #include <cstdlib> #include <ctime> #include <chrono> #include <thread> #include <bits/stdc++.h> #include <pthread.h> #include <vector> #include<unistd.h> using namespace std; vector<vector<int> >matrix1c; vector<vector<int> >matrix2c; vector<vector<int> >matrix3c; int maxelement; int totalelement; int step_i = 0; int r1c; int c1c; int r2c; int c2c; void* multi(void* arg) { int core = step_i++; for (int i = core ..

Read more

The following code is my solution to the cp problem in this link: http://www.usaco.org/index.php?page=viewproblem2&cpid=761 #include<bits/stdc++.h> using namespace std; int main(){ freopen("measurement.in","r",stdin); freopen("measurement.out","w",stdout); vector<tuple<int,int,int>> records; int n; scanf("%d", &n); int day; char* cow; char sign; int change; for (int i=0;i<n;i++){ scanf("%d %s %c%d", &day, cow, &sign, &change); if (sign == ‘-‘) change = -change; int id; ..

Read more

#include<bits/stdc++.h> using namespace std; class graph{ int v; list<int> *adj; bool * vis= new bool; public: graph(int n){ v=n; adj= new list<int>[v]; for (int i = 0; i < v+1; i++) { vis[i]=0; } } void add(int u,int v, bool bi=true){ adj[u].push_back(v); if(bi) adj[v].push_back(u); } void dfs(int s){ vis[s]=1; for(int c:adj[s]){ if(vis[c]==0) dfs(c); } } ..

Read more