-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4-bias.cpp
More file actions
44 lines (40 loc) · 991 Bytes
/
4-bias.cpp
File metadata and controls
44 lines (40 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
using namespace std;
map<int,int> users;
vector<int> reviews[3000000];
char buff[101000];
map<int,bool> isFake;
int main() {
FILE *f = fopen("users.csv","r");
int a,b;
while(fscanf(f,"%d,%d",&a,&b)>0) {
users[a]=b;
}
for(auto x : users ) {
cout << x.first << " " << x.second << endl;
}
FILE *f2 = fopen("reviews.csv","r");
int c;
while(fscanf(f2,"%d,%d,%d,%[^\r]\n",&a,&b,&c,buff) > 0) {
int len = strlen(buff);
reviews[b].push_back(a);
if(c==5 && users[b] < 100 && strlen(buff) <= 100 ) {isFake[a]=true;
cout << a << " " << b << " " << c << " " << string(buff) << endl;
cout << "\n\n\n\n\n\n\n\__________________\n\n\n\n\n\n\n\n\n" ;
}
}
vector<int> ans;
for(int i = 0 ; i < 3000000 ; ++ i ) {
if(reviews[i].size()) {
sort(reviews[i].begin(),reviews[i].end());
if(isFake[reviews[i][0]]) {
ans.push_back(reviews[i][0]);
}
}
}
sort(ans.begin(),ans.end());
for(auto x : ans ) {
cout << x << endl;
}
return 0;
}