This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import json | |
import math | |
from datetime import datetime | |
from sklearn.ensemble import RandomForestRegressor | |
eps = 1e-6 | |
def getMH (x): | |
x = datetime.fromtimestamp (x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import json | |
import math | |
from datetime import datetime | |
from sklearn.ensemble import RandomForestRegressor | |
eps = 1e-6 | |
def getMH (x): | |
x = datetime.fromtimestamp (x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import json | |
import math | |
from datetime import datetime | |
from sklearn.ensemble import RandomForestRegressor | |
eps = 1e-6 | |
def getMH (x): | |
x = datetime.fromtimestamp (x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import json | |
import math | |
from datetime import datetime | |
from sklearn.ensemble import RandomForestRegressor | |
eps = 1e-6 | |
def getMH (x): | |
x = datetime.fromtimestamp (x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Took time of 1227.5 seconds (20 minutes 27 seconds) on kaggle server... | |
# Score: | |
# Private: 0.59736 | |
# Public: 0.62892 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import json | |
import math | |
from datetime import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import json | |
import math | |
from datetime import datetime | |
from sklearn.ensemble import RandomForestRegressor | |
import xgboost | |
eps = 1e-6 | |
def getMH (x): # get normalised time from time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Problem Description: Find which edge to remove and add so as to minimise the number of hops to travel between flights. | |
// It is clear that the edge we remove has to be on the longest path on the original | |
// tree (otherwise we cannot make the longest path shorter). The question is which edge is to be | |
// removed and which edge is to be added. We can consider which edge to be added first. After | |
// removing one edge, the tree become two trees. The edge to be added is the one that connects | |
// the centers of the longest paths of the two subtrees. Because the longest paths of the two | |
// subtrees can always yield some long path after we add the edge. The best way is to split | |
// them into halves. Having this in mind, we can brute-force here - try to remove every edge | |
// on the original longest path and add the new edges respectively. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
#include <string> | |
#include <algorithm> | |
using namespace std; | |
map<string, int> L; | |
int main() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
using namespace std; | |
struct node | |
{ | |
char info; | |
node *left; | |
node *right; | |
}; | |
long long pre; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*This problem asks us to find all possible paths which form the diameter of the given tree. | |
So first we do a BFS/DFS from any vertex uu, and find the vertex xx which is farthest from ss. | |
Note xx must be an end of a longest path. Then, we do another BFS/DFS traversal from xx to | |
find all vertices {s}{s}which are farthest from xx. Every single vertex here, including xx, | |
is one worst root, and the mid point, or points if the length is even, of every single path | |
is/are the best roots. After that, we need to do a third traversal from any vertex in {s} | |
to find any remaining worst roots which are close to xx, and so were not discovered by our | |
second traversal.*/ | |
#include <bits/stdc++.h> |
OlderNewer